:root {
  --py-font-main: "Sarabun", "TH Sarabun New", Tahoma, sans-serif;
  --py-primary: #0a3f3a;
  --py-primary-2: #0f5f56;
  --py-accent: #e85d4f;
  --py-accent-2: #f6b84b;
  --py-mint: #2fb5a5;
  --py-soft: #eef8f4;
  --py-line: #b9ddd5;
  --py-text: #18252b;
  --py-muted: #667780;
}

body {
  background: #f6f8f7;
  color: var(--py-text);
  font-family: var(--py-font-main);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-right: 8px;
  border-radius: 8px;
  background: var(--py-accent-2);
  color: #19323a;
  font-weight: 800;
}

.app-frame {
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  width: 286px;
  display: flex;
  flex-direction: column;
  padding: 16px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(18, 52, 63, 0.98), rgba(22, 70, 74, 0.98)),
    radial-gradient(circle at top left, rgba(244, 178, 75, 0.28), transparent 32%);
  box-shadow: 18px 0 40px rgba(18, 52, 63, 0.18);
  transform: translateX(0);
  transition: transform 0.22s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
}

.sidebar-brand-link {
  min-width: 0;
  display: flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
}

.brand-text {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
}

.sidebar-close {
  display: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
}

.sidebar-context {
  margin: 18px 0 14px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
}

.sidebar-context span {
  display: block;
  color: #ffe2a1;
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.sidebar-context strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
}

.sidebar-nav-group {
  display: grid;
  gap: 4px;
}

.sidebar-nav-heading {
  padding: 8px 10px 3px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
}

.sidebar-nav a {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-weight: 650;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
}

.sidebar-nav a.active .nav-dot {
  background: var(--py-accent-2);
}

.sidebar-footer {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
}

.sidebar-user {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-user strong,
.sidebar-user span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.76rem;
}

.sidebar-user strong {
  font-size: 0.88rem;
  line-height: 1.15;
}

.sidebar-footer .btn {
  min-height: 32px;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: 0.84rem;
}

.app-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin-left: 286px;
  transition: margin-left 0.22s ease;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--py-line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 26px rgba(24, 37, 43, 0.06);
}

.topbar-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-title {
  max-width: 62vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
  font-size: 1.05rem;
}

.topbar-subtitle {
  max-width: 62vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--py-muted);
  font-size: 0.84rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hamburger-btn {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--py-line);
  border-radius: 8px;
  background: #fff;
}

.hamburger-btn span {
  width: 19px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: var(--py-primary);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1030;
  display: none;
  background: rgba(12, 24, 30, 0.52);
}

.sidebar-collapsed .app-sidebar {
  transform: translateX(-100%);
}

.sidebar-collapsed .app-main {
  margin-left: 0;
}

.app-shell {
  max-width: 1440px;
  flex: 1 0 auto;
}

.app-footer {
  background: #fff;
}

.app-card,
.surface-card {
  border: 1px solid var(--py-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(24, 37, 43, 0.06);
}

.surface-card {
  padding: 20px;
}

.stat-tile {
  border-left: 4px solid var(--py-mint);
}

.table th {
  background: var(--py-soft);
  white-space: nowrap;
}

.badge-soft {
  background: var(--py-soft);
  color: var(--py-primary);
}

.btn-primary {
  background: var(--py-primary-2);
  border-color: var(--py-primary-2);
}

.btn-primary:hover {
  background: var(--py-primary);
  border-color: var(--py-primary);
}

.btn-accent {
  background: var(--py-accent);
  border-color: var(--py-accent);
  color: #fff;
}

.btn-accent:hover {
  background: #c85d37;
  border-color: #c85d37;
  color: #fff;
}

.public-home {
  background:
    linear-gradient(180deg, #edf5f1 0%, #f8faf9 34%, #f6f8f7 100%);
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(18, 52, 63, 0.92), rgba(42, 157, 143, 0.76)),
    radial-gradient(circle at top right, rgba(244, 178, 75, 0.35), transparent 28%);
}

.public-hero {
  min-height: 430px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
  align-items: stretch;
  gap: 20px;
  padding: 26px;
  margin-bottom: 18px;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(120deg, rgba(18, 52, 63, 0.94), rgba(30, 93, 99, 0.9)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='640' viewBox='0 0 1200 640'%3E%3Crect width='1200' height='640' fill='%2312343f'/%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.16' stroke-width='6'%3E%3Cpath d='M120 80h960v480H120z'/%3E%3Cpath d='M600 80v480M120 320h960'/%3E%3Ccircle cx='600' cy='320' r='92'/%3E%3Cpath d='M120 190h170v260H120M1080 190H910v260h170'/%3E%3C/g%3E%3Cg fill='%23f4b24b' fill-opacity='.9'%3E%3Ccircle cx='1010' cy='118' r='34'/%3E%3Ccircle cx='170' cy='514' r='22'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  overflow: hidden;
}

.public-hero__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 840px;
}

.hero-kicker {
  width: fit-content;
  margin-bottom: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(244, 178, 75, 0.18);
  color: #ffe2a1;
  font-weight: 700;
  font-size: 0.9rem;
}

.public-hero h1 {
  max-width: 760px;
  margin: 0 0 12px;
  font-size: clamp(2.1rem, 5vw, 4.8rem);
  line-height: 1.02;
  font-weight: 850;
}

.public-hero p {
  max-width: 760px;
  margin-bottom: 20px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.08rem;
}

.hero-search {
  display: flex;
  gap: 8px;
  max-width: 620px;
  margin-bottom: 14px;
}

.hero-search .form-control {
  min-height: 48px;
  border: 0;
}

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

.public-hero__panel {
  align-self: center;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.scoreboard-label {
  color: #ffe2a1;
  font-weight: 800;
  margin-bottom: 12px;
}

.scoreboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.scoreboard-item {
  min-height: 104px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
}

.scoreboard-item span {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.88rem;
}

.scoreboard-item strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.quick-links a {
  padding: 16px 18px;
  border: 1px solid var(--py-line);
  border-radius: 8px;
  background: #fff;
  color: var(--py-primary);
  font-weight: 750;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(24, 37, 43, 0.05);
}

.quick-links a:hover {
  color: var(--py-accent);
  transform: translateY(-1px);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading span {
  color: var(--py-accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.section-heading h2 {
  margin: 2px 0 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.section-heading a {
  color: var(--py-primary-2);
  font-weight: 700;
  text-decoration: none;
}

.timeline-list,
.result-list,
.compact-schedule,
.medal-list {
  display: grid;
  gap: 10px;
}

.timeline-item,
.result-item,
.medal-row,
.compact-schedule > div {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--py-soft);
}

.timeline-item {
  grid-template-columns: 70px minmax(0, 1fr) auto;
}

.timeline-time {
  color: var(--py-primary);
  font-weight: 850;
  font-size: 1.08rem;
}

.timeline-item strong,
.result-item strong {
  display: block;
}

.timeline-item span,
.result-item span,
.compact-schedule small {
  color: var(--py-muted);
}

.status-pill,
.medal-badge {
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  background: #fff;
  color: var(--py-primary);
}

.medal-row {
  grid-template-columns: 38px minmax(0, 1fr) 44px 44px 44px;
}

.rank-no {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
}

.team-name {
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.medal-count {
  min-width: 36px;
  padding: 6px 8px;
  border-radius: 8px;
  text-align: center;
  font-weight: 850;
}

.gold { background: #ffe8a6; color: #7a5300; }
.silver { background: #e9edf1; color: #47515a; }
.bronze { background: #f1d2b5; color: #77451c; }

.result-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.medal-badge.none { background: #eef2f4; color: #58666d; }
.medal-badge.gold { background: #ffe8a6; color: #7a5300; }
.medal-badge.silver { background: #e9edf1; color: #47515a; }
.medal-badge.bronze { background: #f1d2b5; color: #77451c; }

.compact-schedule > div {
  grid-template-columns: 86px minmax(0, 1fr);
}

.compact-schedule time {
  font-weight: 800;
  color: var(--py-primary-2);
}

.compact-schedule span {
  font-weight: 700;
}

.compact-schedule small {
  grid-column: 2;
}

.announcement-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.announcement-grid article {
  padding: 14px;
  border-radius: 8px;
  background: var(--py-soft);
}

.announcement-grid strong {
  display: block;
  margin-bottom: 6px;
}

.announcement-grid p {
  margin: 0;
  color: var(--py-muted);
}

.empty-state {
  padding: 28px 16px;
  border-radius: 8px;
  background: var(--py-soft);
  color: var(--py-muted);
  text-align: center;
}

.certificate-layout-editor {
  display: grid;
  gap: 10px;
}

.certificate-field-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) 80px 80px 84px 70px 110px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--py-line);
  border-radius: 8px;
  background: var(--py-soft);
}

.certificate-field-row .field-name {
  align-self: center;
}

.certificate-print-page {
  margin: 0;
  background: #e9eef0;
}

.certificate-print-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border-bottom: 1px solid var(--py-line);
}

.certificate-sheet {
  position: relative;
  margin: 18px auto;
  background: #fff center/cover no-repeat;
  box-shadow: 0 14px 40px rgba(24, 37, 43, 0.18);
  overflow: hidden;
}

.certificate-sheet.landscape {
  width: 297mm;
  height: 210mm;
}

.certificate-sheet.portrait {
  width: 210mm;
  height: 297mm;
}

.certificate-text {
  position: absolute;
  width: 90%;
  font-family: var(--py-font-main);
  line-height: 1.15;
  white-space: pre-wrap;
}

/* Admin and staff final override: navy operations theme */
body.theme-staff,
body.theme-admin {
  --py-primary: #12395d !important;
  --py-primary-2: #0f2742 !important;
  --py-accent: #d9a441 !important;
  --py-accent-2: #f2c96b !important;
  --py-mint: #2f80a8 !important;
  --py-soft: #eef4f9 !important;
  --py-line: #c8d7e6 !important;
  --py-text: #102033 !important;
  --py-muted: #607287 !important;
  --py-bg: #f4f7fa !important;
  --py-bg-2: #eef3f8 !important;
  --py-sidebar-start: #0f2742 !important;
  --py-sidebar-end: #12395d !important;
  --py-hero-start: #0f2742 !important;
  --py-hero-end: #12395d !important;
}

body.theme-staff,
body.theme-admin {
  background: #f4f7fa !important;
}

.theme-staff .app-sidebar,
.theme-admin .app-sidebar,
.theme-staff .public-hero,
.theme-admin .public-hero,
.theme-staff .hero-stat,
.theme-admin .hero-stat {
  background: #0f2742 !important;
  background-image: none !important;
}

.theme-staff .app-topbar,
.theme-admin .app-topbar {
  border-bottom-color: #c8d7e6 !important;
  background: #ffffff !important;
}

.theme-staff .sidebar-context span,
.theme-admin .sidebar-context span {
  color: #f2c96b !important;
}

.theme-staff .sidebar-nav a.active .nav-dot,
.theme-admin .sidebar-nav a.active .nav-dot {
  background: #f2c96b !important;
}

.theme-staff .btn-primary,
.theme-admin .btn-primary,
.theme-staff .btn-success,
.theme-admin .btn-success,
.theme-staff .btn-info,
.theme-admin .btn-info {
  background: #12395d !important;
  border-color: #12395d !important;
}

.theme-staff .btn-primary:hover,
.theme-admin .btn-primary:hover,
.theme-staff .btn-success:hover,
.theme-admin .btn-success:hover,
.theme-staff .btn-info:hover,
.theme-admin .btn-info:hover {
  background: #0f2742 !important;
  border-color: #0f2742 !important;
}

.theme-staff .btn-outline-primary,
.theme-admin .btn-outline-primary,
.theme-staff .btn-outline-success,
.theme-admin .btn-outline-success,
.theme-staff .btn-outline-info,
.theme-admin .btn-outline-info {
  color: #12395d !important;
  border-color: #12395d !important;
}

.theme-staff .btn-outline-primary:hover,
.theme-admin .btn-outline-primary:hover,
.theme-staff .btn-outline-success:hover,
.theme-admin .btn-outline-success:hover,
.theme-staff .btn-outline-info:hover,
.theme-admin .btn-outline-info:hover {
  color: #ffffff !important;
  background: #12395d !important;
  border-color: #12395d !important;
}

.theme-staff .brand-mark,
.theme-admin .brand-mark,
.theme-staff .btn-accent,
.theme-admin .btn-accent {
  background: #d9a441 !important;
  border-color: #d9a441 !important;
  color: #102033 !important;
}

.report-call-ops {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

.report-call-status-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 72px;
  padding: .9rem 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(15, 23, 42, .06);
}

.report-call-status-tile span {
  font-weight: 700;
}

.report-call-status-tile strong {
  font-size: 1.65rem;
  line-height: 1;
}

.report-call-status-tile.is-active {
  border-width: 2px;
}

.report-call-status-primary.is-active {
  border-color: var(--bs-primary);
}

.report-call-status-secondary.is-active {
  border-color: var(--bs-secondary);
}

.report-call-status-success.is-active {
  border-color: var(--bs-success);
}

.report-call-status-danger.is-active {
  border-color: var(--bs-danger);
}

.report-call-status-tile:hover,
.report-call-status-tile:focus {
  color: var(--bs-body-color);
  border-color: var(--bs-primary);
  transform: translateY(-1px);
}

@media screen and (max-width: 767.98px) {
  .report-call-ops {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-call-status-tile {
    min-height: 64px;
    padding: .75rem;
  }

  .report-call-status-tile strong {
    font-size: 1.35rem;
  }

  .report-call-action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: .35rem;
  }

  .report-call-action-buttons > .btn {
    border-radius: .375rem !important;
    margin-left: 0 !important;
    white-space: nowrap;
  }
}

/* Final override: report-call slips print on A4 landscape with cut guides. */
@media print {
  @page report-call-landscape-final {
    size: A4 landscape;
    margin: 10mm;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet {
    page: report-call-landscape-final !important;
    width: 277mm !important;
    min-width: 277mm !important;
    max-width: 277mm !important;
    margin: 0 auto 5mm !important;
    padding: 0 0 5mm !important;
    border: 0 !important;
    border-bottom: 1px dashed #111 !important;
    box-shadow: none !important;
    break-after: auto !important;
    page-break-after: auto !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet:last-child {
    border-bottom: 0 !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .card-body {
    padding: 0 !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet h2 {
    font-size: 13pt !important;
    margin-bottom: 1mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet div,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .small,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .text-muted {
    font-size: 8.5pt !important;
    line-height: 1.25 !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet table,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    font-size: 8.5pt !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet th,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet td {
    padding: 1mm 1.2mm !important;
    line-height: 1.2 !important;
    vertical-align: top !important;
    border: 1px solid #111 !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .report-call-print-table th:first-child,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .report-call-print-table td:first-child {
    width: 14mm !important;
    min-width: 14mm !important;
    max-width: 14mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet img:not([alt="QR"]) {
    width: 18px !important;
    height: 18px !important;
    object-fit: cover !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .mt-4 {
    margin-top: 3mm !important;
  }
}

/* Final report-call print override: keep report-call sheets as desktop tables. */
@media print {
  @page report-call-landscape {
    size: A4 landscape;
    margin: 8mm;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet {
    page: report-call-landscape !important;
    display: block !important;
    width: 281mm !important;
    max-width: 281mm !important;
    min-width: 281mm !important;
    margin: 0 auto 4mm !important;
    padding: 0 !important;
    background: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
    break-after: page !important;
    page-break-after: always !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet:last-child {
    break-after: auto !important;
    page-break-after: auto !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .card-body {
    display: block !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .d-flex {
    display: flex !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet table,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .table {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet thead {
    display: table-header-group !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet tbody {
    display: table-row-group !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet tr {
    display: table-row !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet th,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet td {
    display: table-cell !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 2mm !important;
    border: 1px solid #111 !important;
    vertical-align: middle !important;
    white-space: normal !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .report-call-print-table th:first-child,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .report-call-print-table td:first-child {
    width: 18mm !important;
    min-width: 18mm !important;
    max-width: 18mm !important;
    text-align: center !important;
    white-space: nowrap !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet th::before,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet td::before {
    content: none !important;
    display: none !important;
  }
}

/* Final report-call print override: keep report-call sheets as desktop tables. */
@media print {
  @page report-call-landscape {
    size: A4 landscape;
    margin: 8mm;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet {
    page: report-call-landscape !important;
    display: block !important;
    width: 281mm !important;
    max-width: 281mm !important;
    min-width: 281mm !important;
    margin: 0 auto 4mm !important;
    padding: 0 !important;
    background: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
    break-after: page !important;
    page-break-after: always !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet:last-child {
    break-after: auto !important;
    page-break-after: auto !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .card-body {
    display: block !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .d-flex {
    display: flex !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet table,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .table {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet thead {
    display: table-header-group !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet tbody {
    display: table-row-group !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet tr {
    display: table-row !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet th,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet td {
    display: table-cell !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 2mm !important;
    border: 1px solid #111 !important;
    vertical-align: middle !important;
    white-space: normal !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet th::before,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet td::before {
    content: none !important;
    display: none !important;
  }
}

/* Keep report-call printouts in desktop/table layout even when printed from mobile-sized views. */
@media print {
  @page report-call-landscape {
    size: A4 landscape;
    margin: 8mm;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet {
    page: report-call-landscape !important;
    display: block !important;
    width: 281mm !important;
    max-width: 281mm !important;
    min-width: 281mm !important;
    margin: 0 auto 4mm !important;
    padding: 0 !important;
    break-after: page !important;
    page-break-after: always !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    background: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet:last-child {
    break-after: auto !important;
    page-break-after: auto !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .card-body {
    display: block !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .d-flex {
    display: flex !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .justify-content-between {
    justify-content: space-between !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .align-items-start {
    align-items: flex-start !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet table,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .table {
    display: table !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    font-size: 9pt !important;
    line-height: 1.2 !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet thead {
    display: table-header-group !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet tbody {
    display: table-row-group !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet tr {
    display: table-row !important;
    width: auto !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet th,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet td {
    display: table-cell !important;
    padding: 2mm !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    border: 1px solid #111 !important;
    vertical-align: middle !important;
    white-space: normal !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet th::before,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet td::before {
    content: none !important;
    display: none !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet img:not([alt="QR"]) {
    width: 8mm !important;
    height: 8mm !important;
    object-fit: cover !important;
  }
}

/* Print layout safety. The final override after mobile rules is below. */
@media print {
  body:not(.certificate-print-page) {
    min-width: 1024px !important;
    background: #fff !important;
  }

  body:not(.certificate-print-page) .app-main,
  body:not(.certificate-print-page) .app-shell,
  body:not(.certificate-print-page) .container,
  body:not(.certificate-print-page) .container-fluid {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body:not(.certificate-print-page) .row {
    display: flex !important;
    flex-wrap: wrap !important;
  }

  body:not(.certificate-print-page) [class*="col-sm-"],
  body:not(.certificate-print-page) [class*="col-md-"],
  body:not(.certificate-print-page) [class*="col-lg-"],
  body:not(.certificate-print-page) [class*="col-xl-"],
  body:not(.certificate-print-page) [class*="col-xxl-"] {
    flex: 0 0 auto !important;
  }

  body:not(.certificate-print-page) .col-sm-1, body:not(.certificate-print-page) .col-md-1, body:not(.certificate-print-page) .col-lg-1, body:not(.certificate-print-page) .col-xl-1, body:not(.certificate-print-page) .col-xxl-1 { width: 8.33333333% !important; }
  body:not(.certificate-print-page) .col-sm-2, body:not(.certificate-print-page) .col-md-2, body:not(.certificate-print-page) .col-lg-2, body:not(.certificate-print-page) .col-xl-2, body:not(.certificate-print-page) .col-xxl-2 { width: 16.66666667% !important; }
  body:not(.certificate-print-page) .col-sm-3, body:not(.certificate-print-page) .col-md-3, body:not(.certificate-print-page) .col-lg-3, body:not(.certificate-print-page) .col-xl-3, body:not(.certificate-print-page) .col-xxl-3 { width: 25% !important; }
  body:not(.certificate-print-page) .col-sm-4, body:not(.certificate-print-page) .col-md-4, body:not(.certificate-print-page) .col-lg-4, body:not(.certificate-print-page) .col-xl-4, body:not(.certificate-print-page) .col-xxl-4 { width: 33.33333333% !important; }
  body:not(.certificate-print-page) .col-sm-5, body:not(.certificate-print-page) .col-md-5, body:not(.certificate-print-page) .col-lg-5, body:not(.certificate-print-page) .col-xl-5, body:not(.certificate-print-page) .col-xxl-5 { width: 41.66666667% !important; }
  body:not(.certificate-print-page) .col-sm-6, body:not(.certificate-print-page) .col-md-6, body:not(.certificate-print-page) .col-lg-6, body:not(.certificate-print-page) .col-xl-6, body:not(.certificate-print-page) .col-xxl-6 { width: 50% !important; }
  body:not(.certificate-print-page) .col-sm-7, body:not(.certificate-print-page) .col-md-7, body:not(.certificate-print-page) .col-lg-7, body:not(.certificate-print-page) .col-xl-7, body:not(.certificate-print-page) .col-xxl-7 { width: 58.33333333% !important; }
  body:not(.certificate-print-page) .col-sm-8, body:not(.certificate-print-page) .col-md-8, body:not(.certificate-print-page) .col-lg-8, body:not(.certificate-print-page) .col-xl-8, body:not(.certificate-print-page) .col-xxl-8 { width: 66.66666667% !important; }
  body:not(.certificate-print-page) .col-sm-9, body:not(.certificate-print-page) .col-md-9, body:not(.certificate-print-page) .col-lg-9, body:not(.certificate-print-page) .col-xl-9, body:not(.certificate-print-page) .col-xxl-9 { width: 75% !important; }
  body:not(.certificate-print-page) .col-sm-10, body:not(.certificate-print-page) .col-md-10, body:not(.certificate-print-page) .col-lg-10, body:not(.certificate-print-page) .col-xl-10, body:not(.certificate-print-page) .col-xxl-10 { width: 83.33333333% !important; }
  body:not(.certificate-print-page) .col-sm-11, body:not(.certificate-print-page) .col-md-11, body:not(.certificate-print-page) .col-lg-11, body:not(.certificate-print-page) .col-xl-11, body:not(.certificate-print-page) .col-xxl-11 { width: 91.66666667% !important; }
  body:not(.certificate-print-page) .col-sm-12, body:not(.certificate-print-page) .col-md-12, body:not(.certificate-print-page) .col-lg-12, body:not(.certificate-print-page) .col-xl-12, body:not(.certificate-print-page) .col-xxl-12 { width: 100% !important; }

  body:not(.certificate-print-page) .card,
  body:not(.certificate-print-page) .app-card,
  body:not(.certificate-print-page) .surface-card,
  body:not(.certificate-print-page) .card-body,
  body:not(.certificate-print-page) .card-header,
  body:not(.certificate-print-page) .card-footer {
    display: block !important;
  }

  body:not(.certificate-print-page) .table-responsive,
  body:not(.certificate-print-page) .table-responsive-mobile {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    overflow: visible !important;
  }

  body:not(.certificate-print-page) table,
  body:not(.certificate-print-page) .table,
  body:not(.certificate-print-page) table.mobile-card-table,
  body:not(.certificate-print-page) .table-responsive table,
  body:not(.certificate-print-page) .table-responsive-mobile table {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
  }

  body:not(.certificate-print-page) thead,
  body:not(.certificate-print-page) table.mobile-card-table thead {
    display: table-header-group !important;
  }

  body:not(.certificate-print-page) tbody,
  body:not(.certificate-print-page) table.mobile-card-table tbody {
    display: table-row-group !important;
  }

  body:not(.certificate-print-page) tfoot,
  body:not(.certificate-print-page) table.mobile-card-table tfoot {
    display: table-footer-group !important;
  }

  body:not(.certificate-print-page) tr,
  body:not(.certificate-print-page) table.mobile-card-table tr {
    display: table-row !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body:not(.certificate-print-page) th,
  body:not(.certificate-print-page) td,
  body:not(.certificate-print-page) table.mobile-card-table th,
  body:not(.certificate-print-page) table.mobile-card-table td {
    display: table-cell !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    vertical-align: top !important;
  }

  body:not(.certificate-print-page) th::before,
  body:not(.certificate-print-page) td::before,
  body:not(.certificate-print-page) table.mobile-card-table th::before,
  body:not(.certificate-print-page) table.mobile-card-table td::before {
    content: none !important;
    display: none !important;
  }
}

/* Print layout safety for document/table layout. */
@media print {
  body:not(.certificate-print-page) {
    min-width: 1024px !important;
    background: #ffffff !important;
  }

  body:not(.certificate-print-page) .app-main,
  body:not(.certificate-print-page) .app-shell,
  body:not(.certificate-print-page) .container,
  body:not(.certificate-print-page) .container-fluid {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body:not(.certificate-print-page) .row {
    display: flex !important;
    flex-wrap: wrap !important;
  }

  body:not(.certificate-print-page) .col-sm-1,
  body:not(.certificate-print-page) .col-md-1,
  body:not(.certificate-print-page) .col-lg-1,
  body:not(.certificate-print-page) .col-xl-1 { flex: 0 0 auto !important; width: 8.33333333% !important; }
  body:not(.certificate-print-page) .col-sm-2,
  body:not(.certificate-print-page) .col-md-2,
  body:not(.certificate-print-page) .col-lg-2,
  body:not(.certificate-print-page) .col-xl-2 { flex: 0 0 auto !important; width: 16.66666667% !important; }
  body:not(.certificate-print-page) .col-sm-3,
  body:not(.certificate-print-page) .col-md-3,
  body:not(.certificate-print-page) .col-lg-3,
  body:not(.certificate-print-page) .col-xl-3 { flex: 0 0 auto !important; width: 25% !important; }
  body:not(.certificate-print-page) .col-sm-4,
  body:not(.certificate-print-page) .col-md-4,
  body:not(.certificate-print-page) .col-lg-4,
  body:not(.certificate-print-page) .col-xl-4 { flex: 0 0 auto !important; width: 33.33333333% !important; }
  body:not(.certificate-print-page) .col-sm-5,
  body:not(.certificate-print-page) .col-md-5,
  body:not(.certificate-print-page) .col-lg-5,
  body:not(.certificate-print-page) .col-xl-5 { flex: 0 0 auto !important; width: 41.66666667% !important; }
  body:not(.certificate-print-page) .col-sm-6,
  body:not(.certificate-print-page) .col-md-6,
  body:not(.certificate-print-page) .col-lg-6,
  body:not(.certificate-print-page) .col-xl-6 { flex: 0 0 auto !important; width: 50% !important; }
  body:not(.certificate-print-page) .col-sm-7,
  body:not(.certificate-print-page) .col-md-7,
  body:not(.certificate-print-page) .col-lg-7,
  body:not(.certificate-print-page) .col-xl-7 { flex: 0 0 auto !important; width: 58.33333333% !important; }
  body:not(.certificate-print-page) .col-sm-8,
  body:not(.certificate-print-page) .col-md-8,
  body:not(.certificate-print-page) .col-lg-8,
  body:not(.certificate-print-page) .col-xl-8 { flex: 0 0 auto !important; width: 66.66666667% !important; }
  body:not(.certificate-print-page) .col-sm-9,
  body:not(.certificate-print-page) .col-md-9,
  body:not(.certificate-print-page) .col-lg-9,
  body:not(.certificate-print-page) .col-xl-9 { flex: 0 0 auto !important; width: 75% !important; }
  body:not(.certificate-print-page) .col-sm-10,
  body:not(.certificate-print-page) .col-md-10,
  body:not(.certificate-print-page) .col-lg-10,
  body:not(.certificate-print-page) .col-xl-10 { flex: 0 0 auto !important; width: 83.33333333% !important; }
  body:not(.certificate-print-page) .col-sm-11,
  body:not(.certificate-print-page) .col-md-11,
  body:not(.certificate-print-page) .col-lg-11,
  body:not(.certificate-print-page) .col-xl-11 { flex: 0 0 auto !important; width: 91.66666667% !important; }
  body:not(.certificate-print-page) .col-sm-12,
  body:not(.certificate-print-page) .col-md-12,
  body:not(.certificate-print-page) .col-lg-12,
  body:not(.certificate-print-page) .col-xl-12 { flex: 0 0 auto !important; width: 100% !important; }

  body:not(.certificate-print-page) .card,
  body:not(.certificate-print-page) .app-card,
  body:not(.certificate-print-page) .surface-card {
    display: block !important;
    width: 100% !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  body:not(.certificate-print-page) .card-body,
  body:not(.certificate-print-page) .card-header,
  body:not(.certificate-print-page) .card-footer {
    display: block !important;
  }

  body:not(.certificate-print-page) .table-responsive,
  body:not(.certificate-print-page) .table-responsive-mobile {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    overflow: visible !important;
  }

  body:not(.certificate-print-page) table,
  body:not(.certificate-print-page) .table,
  body:not(.certificate-print-page) table.mobile-card-table,
  body:not(.certificate-print-page) .table-responsive table.mobile-card-table,
  body:not(.certificate-print-page) .table-responsive-mobile table.mobile-card-table {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
  }

  body:not(.certificate-print-page) thead,
  body:not(.certificate-print-page) table.mobile-card-table thead {
    display: table-header-group !important;
  }

  body:not(.certificate-print-page) tbody,
  body:not(.certificate-print-page) table.mobile-card-table tbody {
    display: table-row-group !important;
  }

  body:not(.certificate-print-page) tfoot,
  body:not(.certificate-print-page) table.mobile-card-table tfoot {
    display: table-footer-group !important;
  }

  body:not(.certificate-print-page) tr,
  body:not(.certificate-print-page) table.mobile-card-table tr {
    display: table-row !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  body:not(.certificate-print-page) th,
  body:not(.certificate-print-page) td,
  body:not(.certificate-print-page) table.mobile-card-table th,
  body:not(.certificate-print-page) table.mobile-card-table td {
    display: table-cell !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    vertical-align: top !important;
  }

  body:not(.certificate-print-page) th::before,
  body:not(.certificate-print-page) td::before,
  body:not(.certificate-print-page) table.mobile-card-table th::before,
  body:not(.certificate-print-page) table.mobile-card-table td::before {
    content: none !important;
    display: none !important;
  }
}

/* Staff final override: teal operations theme */
body.theme-staff {
  --py-primary: #0f766e !important;
  --py-primary-2: #115e59 !important;
  --py-accent: #0ea5e9 !important;
  --py-accent-2: #67e8f9 !important;
  --py-mint: #14b8a6 !important;
  --py-soft: #ecfeff !important;
  --py-line: #99f6e4 !important;
  --py-text: #134e4a !important;
  --py-muted: #5f7480 !important;
  --py-bg: #f0fdfa !important;
  --py-bg-2: #ecfeff !important;
  --py-sidebar-start: #115e59 !important;
  --py-sidebar-end: #0f766e !important;
  --py-hero-start: #115e59 !important;
  --py-hero-end: #0f766e !important;
}

body.theme-staff {
  background: #f0fdfa !important;
}

.theme-staff .app-sidebar,
.theme-staff .public-hero,
.theme-staff .hero-stat {
  background: #115e59 !important;
  background-image: none !important;
}

.theme-staff .app-topbar {
  border-bottom-color: #99f6e4 !important;
  background: #ffffff !important;
}

.theme-staff .sidebar-context span {
  color: #67e8f9 !important;
}

.theme-staff .sidebar-nav a.active .nav-dot {
  background: #67e8f9 !important;
}

.theme-staff .btn-primary,
.theme-staff .btn-success,
.theme-staff .btn-info {
  background: #0f766e !important;
  border-color: #0f766e !important;
}

.theme-staff .btn-primary:hover,
.theme-staff .btn-success:hover,
.theme-staff .btn-info:hover {
  background: #115e59 !important;
  border-color: #115e59 !important;
}

.theme-staff .btn-outline-primary,
.theme-staff .btn-outline-success,
.theme-staff .btn-outline-info {
  color: #0f766e !important;
  border-color: #0f766e !important;
}

.theme-staff .btn-outline-primary:hover,
.theme-staff .btn-outline-success:hover,
.theme-staff .btn-outline-info:hover {
  color: #ffffff !important;
  background: #0f766e !important;
  border-color: #0f766e !important;
}

.theme-staff .brand-mark,
.theme-staff .btn-accent {
  background: #0ea5e9 !important;
  border-color: #0ea5e9 !important;
  color: #ffffff !important;
}

/* Staff final override: teal operations theme */
body.theme-staff {
  --py-primary: #0f766e !important;
  --py-primary-2: #115e59 !important;
  --py-accent: #0ea5e9 !important;
  --py-accent-2: #67e8f9 !important;
  --py-mint: #14b8a6 !important;
  --py-soft: #ecfeff !important;
  --py-line: #99f6e4 !important;
  --py-text: #134e4a !important;
  --py-muted: #5f7480 !important;
  --py-bg: #f0fdfa !important;
  --py-bg-2: #ecfeff !important;
  --py-sidebar-start: #115e59 !important;
  --py-sidebar-end: #0f766e !important;
  --py-hero-start: #115e59 !important;
  --py-hero-end: #0f766e !important;
}

body.theme-staff {
  background: #f0fdfa !important;
}

.theme-staff .app-sidebar,
.theme-staff .public-hero,
.theme-staff .hero-stat {
  background: #115e59 !important;
  background-image: none !important;
}

.theme-staff .app-topbar {
  border-bottom-color: #99f6e4 !important;
  background: #ffffff !important;
}

.theme-staff .sidebar-context span {
  color: #67e8f9 !important;
}

.theme-staff .sidebar-nav a.active .nav-dot {
  background: #67e8f9 !important;
}

.theme-staff .btn-primary,
.theme-staff .btn-success,
.theme-staff .btn-info {
  background: #0f766e !important;
  border-color: #0f766e !important;
}

.theme-staff .btn-primary:hover,
.theme-staff .btn-success:hover,
.theme-staff .btn-info:hover {
  background: #115e59 !important;
  border-color: #115e59 !important;
}

.theme-staff .btn-outline-primary,
.theme-staff .btn-outline-success,
.theme-staff .btn-outline-info {
  color: #0f766e !important;
  border-color: #0f766e !important;
}

.theme-staff .btn-outline-primary:hover,
.theme-staff .btn-outline-success:hover,
.theme-staff .btn-outline-info:hover {
  color: #ffffff !important;
  background: #0f766e !important;
  border-color: #0f766e !important;
}

.theme-staff .brand-mark,
.theme-staff .btn-accent {
  background: #0ea5e9 !important;
  border-color: #0ea5e9 !important;
  color: #ffffff !important;
}

.phase-option {
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.phase-option:hover {
  border-color: var(--bs-primary) !important;
  box-shadow: 0 0 0 .15rem rgba(13, 110, 253, .12);
}

.btn-check:checked + .phase-option {
  border-color: var(--bs-primary) !important;
  background-color: var(--bs-primary-bg-subtle) !important;
  box-shadow: 0 0 0 .18rem rgba(13, 110, 253, .18);
}

details.app-card > summary {
  cursor: pointer;
  list-style: none;
}
details.app-card > summary::-webkit-details-marker {
  display: none;
}
details.app-card[open] > summary .btn {
  color: #fff;
  background-color: var(--bs-secondary);
  border-color: var(--bs-secondary);
}

.cert-text-content {
  display: block;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .sidebar-open .app-sidebar {
    transform: translateX(0);
  }
  .sidebar-open .sidebar-backdrop {
    display: block;
  }
  .sidebar-close {
    display: inline-grid;
    place-items: center;
  }
  .app-main {
    margin-left: 0;
  }
  .app-topbar {
    padding: 10px 14px;
  }
  .topbar-actions {
    gap: 6px;
  }
  .public-hero {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  .quick-links,
  .announcement-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .certificate-field-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .certificate-field-row .field-name {
    grid-column: 1 / -1;
  }
}

@media (max-width: 575.98px) {
  .app-sidebar {
    width: min(88vw, 320px);
  }
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }
  .public-hero {
    min-height: auto;
    padding: 18px;
  }
  .hero-search {
    flex-direction: column;
  }
  .scoreboard-grid,
  .quick-links,
  .announcement-grid {
    grid-template-columns: 1fr;
  }
  .timeline-item {
    grid-template-columns: 1fr;
  }
  .medal-row {
    grid-template-columns: 32px minmax(0, 1fr) 38px 38px 38px;
  }
  .certificate-field-row {
    grid-template-columns: 1fr;
  }
}

@media print {
  .app-sidebar, .app-topbar, .sidebar-backdrop, footer, .btn, .no-print {
    display: none !important;
  }
  .app-main {
    margin-left: 0;
  }
  body {
    background: #fff;
  }
  .app-card,
  .surface-card {
    box-shadow: none;
    border: 0;
  }
  @page {
    size: A4 landscape;
    margin: 0;
  }
  .certificate-print-page {
    background: #fff;
  }
  .certificate-sheet {
    margin: 0;
    box-shadow: none;
    page-break-after: always;
  }
  .certificate-sheet.landscape {
    width: 297mm;
    height: 210mm;
  }
  .certificate-sheet.portrait {
    width: 210mm;
    height: 297mm;
  }
}

/* Certificate manager - simplified workflow */
.cert-step-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--py-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(16, 36, 40, .06);
  height: 100%;
}
.cert-step-card span {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--py-primary);
  color: #fff;
  font-weight: 800;
}
.cert-step-card small {
  display: block;
  color: var(--py-muted);
  margin-top: 2px;
}
.cert-card-preview {
  position: relative;
  height: 190px;
  background: var(--py-soft);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.cert-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cert-no-bg {
  color: var(--py-muted);
  font-size: .95rem;
}
.cert-status-badge {
  position: absolute;
  top: 10px;
  right: 10px;
}
.cert-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr);
  gap: 16px;
  align-items: start;
}
.cert-preview-panel {
  position: sticky;
  top: 12px;
  padding: 12px;
  border: 1px solid var(--py-line);
  border-radius: 14px;
  background: #fff;
}
.cert-preview-wrap {
  overflow: auto;
  max-height: 72vh;
  border: 1px dashed var(--py-line);
  border-radius: 12px;
  background: #eef3f4;
  padding: 10px;
}
.certificate-sheet.preview {
  transform: scale(.34);
  transform-origin: top left;
  margin: 0;
  box-shadow: 0 8px 24px rgba(24, 37, 43, .18);
}
.cert-preview-wrap:has(.certificate-sheet.preview.landscape) {
  height: calc(210mm * .34 + 22px);
}
.cert-preview-wrap:has(.certificate-sheet.preview.portrait) {
  height: calc(297mm * .34 + 22px);
}
.cert-field-group {
  border: 1px solid var(--py-line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}
.cert-field-group + .cert-field-group {
  margin-top: 12px;
}
.cert-field-group-title {
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--py-primary);
}
.cert-position-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.cert-position-buttons .btn {
  padding: 2px 7px;
  font-size: .75rem;
}

@media (max-width: 1199.98px) {
  .cert-editor-grid {
    grid-template-columns: 1fr;
  }
  .cert-preview-panel {
    position: static;
  }
}
@media (max-width: 575.98px) {
  .cert-card-preview {
    height: 150px;
  }
  .cert-preview-wrap {
    max-height: 50vh;
  }
}

/* Certificate editor full-page preview (admin add/edit no modal) */
.certificate-sheet.cert-editor-preview {
  transform: scale(.52);
  transform-origin: top left;
  margin: 0;
  box-shadow: 0 10px 30px rgba(24, 37, 43, .20);
}
.cert-preview-wrap:has(.certificate-sheet.cert-editor-preview.landscape) {
  min-height: calc(210mm * .52 + 24px);
}
.cert-preview-wrap:has(.certificate-sheet.cert-editor-preview.portrait) {
  min-height: calc(297mm * .52 + 24px);
}
@media (max-width: 1199.98px) {
  .certificate-sheet.cert-editor-preview { transform: scale(.42); }
  .cert-preview-wrap:has(.certificate-sheet.cert-editor-preview.landscape) { min-height: calc(210mm * .42 + 24px); }
  .cert-preview-wrap:has(.certificate-sheet.cert-editor-preview.portrait) { min-height: calc(297mm * .42 + 24px); }
}


/* Drag and resize certificate fields directly in preview */
[data-cert-editor-form] .certificate-sheet {
  user-select: none;
}
[data-cert-editor-form] .certificate-text {
  cursor: move;
  min-width: 24px;
  min-height: 14px;
  padding: 2px 5px;
  border: 1px dashed transparent;
  border-radius: 4px;
}
[data-cert-editor-form] .certificate-text:hover,
[data-cert-editor-form] .certificate-text.cert-field-selected {
  border-color: rgba(13, 110, 253, .85);
  background: rgba(13, 110, 253, .06);
}
.cert-resize-handle {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0d6efd;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  cursor: nwse-resize;
  display: none;
  z-index: 5;
}
.certificate-text.cert-field-selected .cert-resize-handle,
.certificate-text:hover .cert-resize-handle {
  display: block;
}
.cert-dragging-active {
  cursor: grabbing !important;
}

/* Homepage management and public slideshow */
.home-banner-section {
  --home-banner-window: 100vw;
  width: var(--home-banner-window);
  margin-left: calc(50% - (var(--home-banner-window) / 2));
  margin-right: calc(50% - (var(--home-banner-window) / 2));
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(18, 52, 63, 0.12);
  background: #fff;
}

@media (min-width: 992px) {
  body.has-sidebar:not(.sidebar-collapsed) .home-banner-section {
    --home-banner-window: calc(100vw - 286px);
  }
}

.home-banner-carousel .carousel-item {
  position: relative;
  background: #102f3a;
}

.home-banner-carousel .carousel-item img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.homepage-admin-logo {
  max-width: 140px;
  max-height: 140px;
  object-fit: contain;
  border: 1px solid var(--py-line);
  border-radius: 16px;
  padding: 10px;
  background: #fff;
}

.homepage-banner-admin-card {
  overflow: hidden;
  height: 100%;
  border: 1px solid var(--py-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(18, 52, 63, 0.08);
}

.homepage-banner-admin-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.homepage-banner-modal-preview {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--py-line);
}

/* เอกสารรายงานตัว */
.report-call-sheet { break-inside: avoid; page-break-inside: avoid; }
.report-call-sheet table th, .report-call-sheet table td { vertical-align: middle; }
.report-call-print-table .report-call-seq-col,
.report-call-print-table th:first-child,
.report-call-print-table td:first-child {
  width: 18mm !important;
  min-width: 18mm !important;
  max-width: 18mm !important;
  text-align: center;
  white-space: nowrap;
}
.report-call-sheet,
.report-call-sheet .table-responsive {
  overflow: visible !important;
}
.report-call-sheet table {
  table-layout: fixed;
}
.report-call-sheet th,
.report-call-sheet td {
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}
@media print {
  .no-print, .app-sidebar, .app-topbar, .sidebar-backdrop, .btn, form.no-print { display: none !important; }
  body.has-sidebar, .app-main { padding: 0 !important; margin: 0 !important; background: #fff !important; }
  .app-shell { padding: 0 !important; margin: 0 !important; max-width: none !important; width: 100% !important; }
  .print-card, .report-call-sheet { border: 0 !important; box-shadow: none !important; margin: 0 !important; page-break-after: always; }
  .print-card .card-body { padding: 12mm !important; }
  .report-call-sheet table { font-size: 13px; }
  .report-call-sheet .table > :not(caption) > * > * { padding: .38rem .45rem; }
}

/* สดใสแบบแยกธีมตามบทบาท: ทั่วไป / โรงเรียน / เจ้าหน้าที่ / แอดมิน */
:root,
.theme-public {
  --py-primary: #0f766e;
  --py-primary-2: #14b8a6;
  --py-accent: #f97316;
  --py-accent-2: #facc15;
  --py-mint: #22c55e;
  --py-soft: #ecfeff;
  --py-line: #bae6fd;
  --py-text: #134e4a;
  --py-muted: #64748b;
  --py-bg: #f0fdfa;
  --py-bg-2: #ecfeff;
  --py-sidebar-start: #0f766e;
  --py-sidebar-end: #0891b2;
  --py-sidebar-glow: rgba(250, 204, 21, .35);
  --py-hero-start: rgba(15, 118, 110, .94);
  --py-hero-end: rgba(8, 145, 178, .88);
  --py-card-shadow: rgba(14, 116, 144, .13);
}

.theme-unit {
  --py-primary: #166534;
  --py-primary-2: #22c55e;
  --py-accent: #0ea5e9;
  --py-accent-2: #bef264;
  --py-mint: #14b8a6;
  --py-soft: #f0fdf4;
  --py-line: #bbf7d0;
  --py-text: #14532d;
  --py-muted: #64748b;
  --py-bg: #f0fdf4;
  --py-bg-2: #ecfdf5;
  --py-sidebar-start: #166534;
  --py-sidebar-end: #16a34a;
  --py-sidebar-glow: rgba(190, 242, 100, .38);
  --py-hero-start: rgba(22, 101, 52, .94);
  --py-hero-end: rgba(20, 184, 166, .84);
  --py-card-shadow: rgba(22, 163, 74, .14);
}

.theme-staff {
  --py-primary: #0a3f3a;
  --py-primary-2: #3b82f6;
  --py-accent: #06b6d4;
  --py-accent-2: #a5f3fc;
  --py-mint: #0ea5e9;
  --py-soft: #eef8f4;
  --py-line: #bfdbfe;
  --py-text: #1e3a8a;
  --py-muted: #64748b;
  --py-bg: #eef8f4;
  --py-bg-2: #f0f9ff;
  --py-sidebar-start: #1e40af;
  --py-sidebar-end: #0284c7;
  --py-sidebar-glow: rgba(165, 243, 252, .34);
  --py-hero-start: rgba(30, 64, 175, .94);
  --py-hero-end: rgba(2, 132, 199, .84);
  --py-card-shadow: rgba(37, 99, 235, .14);
}

.theme-admin {
  --py-primary: #7e22ce;
  --py-primary-2: #a855f7;
  --py-accent: #ec4899;
  --py-accent-2: #fde047;
  --py-mint: #8b5cf6;
  --py-soft: #faf5ff;
  --py-line: #e9d5ff;
  --py-text: #581c87;
  --py-muted: #64748b;
  --py-bg: #faf5ff;
  --py-bg-2: #fdf2f8;
  --py-sidebar-start: #6b21a8;
  --py-sidebar-end: #be185d;
  --py-sidebar-glow: rgba(253, 224, 71, .35);
  --py-hero-start: rgba(107, 33, 168, .94);
  --py-hero-end: rgba(190, 24, 93, .84);
  --py-card-shadow: rgba(168, 85, 247, .15);
}

body {
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--py-accent-2) 18%, transparent), transparent 32%),
    linear-gradient(180deg, var(--py-bg) 0%, #ffffff 46%, var(--py-bg-2) 100%);
}

.app-sidebar {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--py-sidebar-start) 98%, #000 2%), color-mix(in srgb, var(--py-sidebar-end) 95%, #000 5%)),
    radial-gradient(circle at top left, var(--py-sidebar-glow), transparent 34%);
  box-shadow: 18px 0 42px color-mix(in srgb, var(--py-primary) 22%, transparent);
}

.brand-mark {
  background: var(--py-accent-2);
  color: color-mix(in srgb, var(--py-primary) 78%, #000 22%);
}

.sidebar-context span,
.scoreboard-label,
.hero-kicker {
  color: var(--py-accent-2);
}

.sidebar-nav a.active .nav-dot {
  background: var(--py-accent-2);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--py-accent-2) 22%, transparent);
}

.app-topbar {
  border-bottom-color: var(--py-line);
  background: color-mix(in srgb, #fff 88%, var(--py-soft));
}

.app-card,
.surface-card,
.quick-links a,
.cert-step-card,
.cert-preview-panel,
.cert-field-group,
.homepage-banner-admin-card {
  border-color: var(--py-line);
  box-shadow: 0 14px 32px var(--py-card-shadow);
}

.btn-primary {
  background: linear-gradient(135deg, var(--py-primary), var(--py-primary-2));
  border-color: var(--py-primary-2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, color-mix(in srgb, var(--py-primary) 86%, #000), var(--py-primary));
  border-color: var(--py-primary);
}

.btn-outline-primary {
  color: var(--py-primary);
  border-color: var(--py-primary-2);
}

.btn-outline-primary:hover {
  background: var(--py-primary);
  border-color: var(--py-primary);
  color: #fff;
}

.btn-accent {
  background: linear-gradient(135deg, var(--py-accent), color-mix(in srgb, var(--py-accent) 78%, var(--py-accent-2)));
  border-color: var(--py-accent);
}

.btn-accent:hover {
  background: color-mix(in srgb, var(--py-accent) 86%, #000);
  border-color: color-mix(in srgb, var(--py-accent) 86%, #000);
}

.table th,
.empty-state,
.timeline-item,
.result-item,
.medal-row,
.compact-schedule > div,
.announcement-grid article,
.certificate-field-row {
  background: var(--py-soft);
}

.public-home {
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--py-accent-2) 22%, transparent), transparent 28%),
    linear-gradient(180deg, var(--py-bg) 0%, #fff 42%, var(--py-bg-2) 100%);
}

.public-hero {
  background:
    linear-gradient(120deg, var(--py-hero-start), var(--py-hero-end)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='640' viewBox='0 0 1200 640'%3E%3Crect width='1200' height='640' fill='%230f766e'/%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.18' stroke-width='6'%3E%3Cpath d='M120 80h960v480H120z'/%3E%3Cpath d='M600 80v480M120 320h960'/%3E%3Ccircle cx='600' cy='320' r='92'/%3E%3Cpath d='M120 190h170v260H120M1080 190H910v260h170'/%3E%3C/g%3E%3Cg fill='%23facc15' fill-opacity='.9'%3E%3Ccircle cx='1010' cy='118' r='34'/%3E%3Ccircle cx='170' cy='514' r='22'/%3E%3C/g%3E%3C/svg%3E");
}

.theme-public .sidebar-context span::after { content: ' / ทั่วไป'; }
.theme-unit .sidebar-context span::after { content: ' / โรงเรียน'; }
.theme-staff .sidebar-context span::after { content: ' / เจ้าหน้าที่'; }
.theme-admin .sidebar-context span::after { content: ' / แอดมิน'; }


/* บังคับใช้สีตามบทบาทจริง ป้องกัน CSS เก่าหรือ Bootstrap ทับ */
body.theme-public,
body.theme-unit,
body.theme-staff,
body.theme-admin {
  background:
    radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--py-accent-2) 24%, transparent), transparent 32%),
    radial-gradient(circle at 100% 12%, color-mix(in srgb, var(--py-primary-2) 18%, transparent), transparent 30%),
    linear-gradient(180deg, var(--py-bg) 0%, #ffffff 46%, var(--py-bg-2) 100%) !important;
  color: var(--py-text) !important;
}

.theme-public .app-sidebar,
.theme-unit .app-sidebar,
.theme-staff .app-sidebar,
.theme-admin .app-sidebar {
  background:
    radial-gradient(circle at top left, var(--py-sidebar-glow), transparent 36%),
    linear-gradient(180deg, var(--py-sidebar-start), var(--py-sidebar-end)) !important;
  box-shadow: 18px 0 42px var(--py-card-shadow) !important;
}

.theme-public .brand-mark,
.theme-unit .brand-mark,
.theme-staff .brand-mark,
.theme-admin .brand-mark,
.theme-public .cert-step-card span,
.theme-unit .cert-step-card span,
.theme-staff .cert-step-card span,
.theme-admin .cert-step-card span {
  background: var(--py-accent-2) !important;
  color: color-mix(in srgb, var(--py-primary) 78%, #000 22%) !important;
}

.theme-public .app-topbar,
.theme-unit .app-topbar,
.theme-staff .app-topbar,
.theme-admin .app-topbar {
  border-bottom-color: var(--py-line) !important;
  background: color-mix(in srgb, #fff 88%, var(--py-soft)) !important;
}

.theme-public .app-card,
.theme-unit .app-card,
.theme-staff .app-card,
.theme-admin .app-card,
.theme-public .surface-card,
.theme-unit .surface-card,
.theme-staff .surface-card,
.theme-admin .surface-card,
.theme-public .quick-links a,
.theme-unit .quick-links a,
.theme-staff .quick-links a,
.theme-admin .quick-links a,
.theme-public .cert-step-card,
.theme-unit .cert-step-card,
.theme-staff .cert-step-card,
.theme-admin .cert-step-card,
.theme-public .cert-preview-panel,
.theme-unit .cert-preview-panel,
.theme-staff .cert-preview-panel,
.theme-admin .cert-preview-panel,
.theme-public .cert-field-group,
.theme-unit .cert-field-group,
.theme-staff .cert-field-group,
.theme-admin .cert-field-group,
.theme-public .homepage-banner-admin-card,
.theme-unit .homepage-banner-admin-card,
.theme-staff .homepage-banner-admin-card,
.theme-admin .homepage-banner-admin-card {
  border-color: var(--py-line) !important;
  box-shadow: 0 14px 32px var(--py-card-shadow) !important;
}

.theme-public .btn-primary,
.theme-unit .btn-primary,
.theme-staff .btn-primary,
.theme-admin .btn-primary,
.theme-public .btn-success,
.theme-unit .btn-success,
.theme-staff .btn-success,
.theme-admin .btn-success,
.theme-public .btn-info,
.theme-unit .btn-info,
.theme-staff .btn-info,
.theme-admin .btn-info {
  background: linear-gradient(135deg, var(--py-primary), var(--py-primary-2)) !important;
  border-color: var(--py-primary-2) !important;
  color: #fff !important;
}

.theme-public .btn-warning,
.theme-unit .btn-warning,
.theme-staff .btn-warning,
.theme-admin .btn-warning,
.theme-public .btn-accent,
.theme-unit .btn-accent,
.theme-staff .btn-accent,
.theme-admin .btn-accent {
  background: linear-gradient(135deg, var(--py-accent), color-mix(in srgb, var(--py-accent) 68%, var(--py-accent-2))) !important;
  border-color: var(--py-accent) !important;
  color: #fff !important;
}

.theme-public .btn-outline-primary,
.theme-unit .btn-outline-primary,
.theme-staff .btn-outline-primary,
.theme-admin .btn-outline-primary,
.theme-public .btn-outline-success,
.theme-unit .btn-outline-success,
.theme-staff .btn-outline-success,
.theme-admin .btn-outline-success,
.theme-public .btn-outline-info,
.theme-unit .btn-outline-info,
.theme-staff .btn-outline-info,
.theme-admin .btn-outline-info {
  border-color: var(--py-primary-2) !important;
  color: var(--py-primary) !important;
}

.theme-public .btn-outline-primary:hover,
.theme-unit .btn-outline-primary:hover,
.theme-staff .btn-outline-primary:hover,
.theme-admin .btn-outline-primary:hover,
.theme-public .btn-outline-success:hover,
.theme-unit .btn-outline-success:hover,
.theme-staff .btn-outline-success:hover,
.theme-admin .btn-outline-success:hover,
.theme-public .btn-outline-info:hover,
.theme-unit .btn-outline-info:hover,
.theme-staff .btn-outline-info:hover,
.theme-admin .btn-outline-info:hover {
  background: var(--py-primary) !important;
  border-color: var(--py-primary) !important;
  color: #fff !important;
}

.theme-public .bg-primary,
.theme-unit .bg-primary,
.theme-staff .bg-primary,
.theme-admin .bg-primary,
.theme-public .text-bg-primary,
.theme-unit .text-bg-primary,
.theme-staff .text-bg-primary,
.theme-admin .text-bg-primary {
  background-color: var(--py-primary) !important;
  color: #fff !important;
}

.theme-public .text-primary,
.theme-unit .text-primary,
.theme-staff .text-primary,
.theme-admin .text-primary,
.theme-public .section-heading span,
.theme-unit .section-heading span,
.theme-staff .section-heading span,
.theme-admin .section-heading span,
.theme-public .quick-links a:hover,
.theme-unit .quick-links a:hover,
.theme-staff .quick-links a:hover,
.theme-admin .quick-links a:hover {
  color: var(--py-primary) !important;
}

.theme-public .table th,
.theme-unit .table th,
.theme-staff .table th,
.theme-admin .table th,
.theme-public .empty-state,
.theme-unit .empty-state,
.theme-staff .empty-state,
.theme-admin .empty-state,
.theme-public .timeline-item,
.theme-unit .timeline-item,
.theme-staff .timeline-item,
.theme-admin .timeline-item,
.theme-public .result-item,
.theme-unit .result-item,
.theme-staff .result-item,
.theme-admin .result-item,
.theme-public .medal-row,
.theme-unit .medal-row,
.theme-staff .medal-row,
.theme-admin .medal-row,
.theme-public .compact-schedule > div,
.theme-unit .compact-schedule > div,
.theme-staff .compact-schedule > div,
.theme-admin .compact-schedule > div,
.theme-public .announcement-grid article,
.theme-unit .announcement-grid article,
.theme-staff .announcement-grid article,
.theme-admin .announcement-grid article,
.theme-public .certificate-field-row,
.theme-unit .certificate-field-row,
.theme-staff .certificate-field-row,
.theme-admin .certificate-field-row {
  background: var(--py-soft) !important;
}

.theme-public .public-home,
.theme-unit .public-home,
.theme-staff .public-home,
.theme-admin .public-home,
.theme-public .login-page,
.theme-unit .login-page,
.theme-staff .login-page,
.theme-admin .login-page {
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--py-accent-2) 24%, transparent), transparent 30%),
    linear-gradient(180deg, var(--py-bg) 0%, #fff 42%, var(--py-bg-2) 100%) !important;
}

.theme-public .public-hero,
.theme-unit .public-hero,
.theme-staff .public-hero,
.theme-admin .public-hero {
  background:
    linear-gradient(120deg, var(--py-hero-start), var(--py-hero-end)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='640' viewBox='0 0 1200 640'%3E%3Crect width='1200' height='640' fill='%230f766e'/%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.18' stroke-width='6'%3E%3Cpath d='M120 80h960v480H120z'/%3E%3Cpath d='M600 80v480M120 320h960'/%3E%3Ccircle cx='600' cy='320' r='92'/%3E%3Cpath d='M120 190h170v260H120M1080 190H910v260h170'/%3E%3C/g%3E%3Cg fill='%23facc15' fill-opacity='.9'%3E%3Ccircle cx='1010' cy='118' r='34'/%3E%3Ccircle cx='170' cy='514' r='22'/%3E%3C/g%3E%3C/svg%3E") !important;
  color: #fff !important;
}

.theme-public .cert-resize-handle,
.theme-unit .cert-resize-handle,
.theme-staff .cert-resize-handle,
.theme-admin .cert-resize-handle {
  background: var(--py-primary) !important;
}

.theme-public [data-cert-editor-form] .certificate-text:hover,
.theme-public [data-cert-editor-form] .certificate-text.cert-field-selected,
.theme-unit [data-cert-editor-form] .certificate-text:hover,
.theme-unit [data-cert-editor-form] .certificate-text.cert-field-selected,
.theme-staff [data-cert-editor-form] .certificate-text:hover,
.theme-staff [data-cert-editor-form] .certificate-text.cert-field-selected,
.theme-admin [data-cert-editor-form] .certificate-text:hover,
.theme-admin [data-cert-editor-form] .certificate-text.cert-field-selected {
  border-color: color-mix(in srgb, var(--py-primary) 80%, transparent) !important;
  background: color-mix(in srgb, var(--py-primary) 8%, transparent) !important;
}

/* Mobile friendly improvements */
html {
  -webkit-text-size-adjust: 100%;
}
body {
  overflow-x: hidden;
}
img, svg, video, canvas {
  max-width: 100%;
  height: auto;
}
.form-control,
.form-select,
.btn,
.input-group-text {
  min-height: 42px;
}
.form-control,
.form-select,
textarea.form-control {
  font-size: 16px; /* prevent iOS zoom */
}
.pyc-search-select {
  position: relative;
  width: 100%;
}
.pyc-search-native {
  position: absolute !important;
  left: 0;
  top: 0;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.pyc-search-toggle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pyc-search-panel {
  display: none;
  position: absolute;
  z-index: 1085;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  padding: .5rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .18);
}
.pyc-search-select.open .pyc-search-panel {
  display: block;
}
.pyc-search-input {
  margin-bottom: .45rem;
}
.pyc-search-options {
  max-height: 260px;
  overflow-y: auto;
  border-radius: .35rem;
}
.pyc-search-option {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--bs-body-color);
  text-align: left;
  padding: .45rem .55rem;
  border-radius: .35rem;
}
.pyc-search-option:hover,
.pyc-search-option.active {
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary-text-emphasis);
}
.pyc-search-option.selected {
  background: var(--bs-primary);
  color: #fff;
}
.pyc-search-option:disabled {
  color: var(--bs-secondary-color);
  cursor: default;
}
.pyc-search-empty {
  color: var(--bs-secondary-color);
  padding: .65rem .55rem;
  text-align: center;
}
.btn-sm,
.input-group-sm > .form-control,
.input-group-sm > .form-select,
.input-group-sm > .btn,
.input-group-sm > .input-group-text {
  min-height: 36px;
}
.table-responsive,
.table-responsive-mobile {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-responsive-mobile > .table,
.table-responsive > .table {
  margin-bottom: 0;
}
.mobile-scroll-hint {
  display: none;
  color: var(--py-muted);
  font-size: .82rem;
  padding: .25rem .75rem .5rem;
}
.action-buttons,
.btn-toolbar,
.card-actions,
.page-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.card-header,
.app-card .card-header {
  gap: .75rem;
}
.app-card .card-header .btn,
.surface-card .btn {
  white-space: normal;
}
.modal-content {
  border-radius: 14px;
}
.modal-body {
  overflow-x: hidden;
}
.cert-preview-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.cert-preview-panel {
  min-width: 0;
}
.certificate-field-row input,
.certificate-field-row select {
  min-width: 0;
}

@media (max-width: 991.98px) {
  .app-topbar {
    min-height: 60px;
  }
  .topbar-title {
    max-width: calc(100vw - 86px);
    font-size: 1rem;
  }
  .topbar-subtitle {
    max-width: calc(100vw - 86px);
  }
  .sidebar-nav a {
    min-height: 44px;
    font-size: .98rem;
  }
  .app-shell {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
  .surface-card {
    padding: 16px;
  }
  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }
  .section-heading a,
  .section-heading .btn {
    width: 100%;
  }
  .hero-actions .btn,
  .quick-links a {
    min-height: 46px;
  }
  .public-hero__panel {
    align-self: stretch;
  }
  .app-table-search {
    padding-left: .75rem !important;
    padding-right: .75rem !important;
  }
  .table-responsive-mobile + .mobile-scroll-hint,
  .table-responsive + .mobile-scroll-hint {
    display: block;
  }
}

@media (max-width: 767.98px) {
  .container-fluid.app-shell {
    padding-left: .75rem;
    padding-right: .75rem;
  }
  .app-card,
  .surface-card,
  .public-hero,
  .public-hero__panel,
  .quick-links a,
  .announcement-card,
  .homepage-banner-modal-preview {
    border-radius: 14px;
  }
  .row {
    --bs-gutter-x: .75rem;
    --bs-gutter-y: .75rem;
  }
  .card-body,
  .card-header,
  .card-footer {
    padding: .85rem;
  }
  .card-header {
    flex-direction: column;
    align-items: stretch !important;
  }
  .card-header > .d-flex,
  .surface-card > .d-flex,
  .app-card > .d-flex {
    flex-wrap: wrap;
  }
  .btn-group,
  .btn-group-sm {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
  }
  .btn-group > .btn,
  .btn-group-sm > .btn {
    border-radius: .5rem !important;
  }
  .table {
    min-width: 720px;
    font-size: .92rem;
  }
  .table th,
  .table td {
    padding: .55rem .65rem;
    vertical-align: middle;
  }
  .table .btn,
  td .btn {
    margin-bottom: .25rem;
  }
  .input-group {
    flex-wrap: nowrap;
  }
  .input-group > .form-control,
  .input-group > .form-select {
    min-width: 0;
  }
  .modal-dialog {
    margin: .5rem;
  }
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: .85rem;
  }
  .modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .modal-footer .btn {
    width: 100%;
  }
  .nav-tabs,
  .nav-pills {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .nav-tabs .nav-link,
  .nav-pills .nav-link {
    white-space: nowrap;
  }
  .certificate-layout-editor,
  .cert-editor-grid {
    grid-template-columns: 1fr !important;
  }
  .certificate-sheet.cert-editor-preview {
    transform: scale(.34);
  }
  .cert-preview-wrap:has(.certificate-sheet.cert-editor-preview.landscape) {
    min-height: calc(210mm * .34 + 24px);
    min-width: 100%;
  }
  .cert-preview-wrap:has(.certificate-sheet.cert-editor-preview.portrait) {
    min-height: calc(297mm * .34 + 24px);
    min-width: 100%;
  }
}

.announcement-grid article {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.announcement-grid article a {
  font-weight: 700;
  text-decoration: none;
}

.announcement-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, .08);
  background: #f8fafc;
}

.announcement-detail {
  max-width: 920px;
  margin: 0 auto;
}

.announcement-detail-image {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, .08);
  background: #f8fafc;
  margin: 1rem 0;
}

.announcement-detail-body {
  font-size: 1rem;
  line-height: 1.9;
  color: #1f2937;
  white-space: normal;
}

.announcement-attachment {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(15, 23, 42, .1);
}

.announcement-attachment span {
  color: #475569;
  overflow-wrap: anywhere;
}

.criteria-page {
  max-width: 980px;
  margin: 0 auto;
}

.criteria-list {
  display: grid;
  gap: 1rem;
}

.criteria-item {
  display: grid;
  gap: .75rem;
  padding: 1rem;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 8px;
  background: #fff;
}

.criteria-item h2 {
  font-size: 1.15rem;
  margin: 0 0 .5rem;
}

.criteria-body {
  color: #334155;
  line-height: 1.8;
}

/* Mobile-first hardening across every screen. Normal data tables become compact
   labelled rows, while print/document tables keep their real table shape. */
@media screen and (max-width: 991.98px) {
  html,
  body,
  .app-frame,
  .app-main,
  .app-shell {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .app-shell {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .app-topbar {
    align-items: flex-start;
  }

  .topbar-left {
    min-width: 0;
  }

  .topbar-actions {
    max-width: 42vw;
    justify-content: flex-end;
  }

  .topbar-actions .btn {
    min-height: 36px;
    padding-left: .6rem;
    padding-right: .6rem;
    white-space: normal;
  }

  .card,
  .app-card,
  .surface-card,
  .modal-content,
  .alert {
    max-width: 100%;
  }

  .row > * {
    min-width: 0;
  }

  .d-flex,
  .section-heading,
  .page-actions,
  .card-actions,
  .form-actions {
    min-width: 0;
  }

  .form-control,
  .form-select,
  .input-group,
  .btn {
    max-width: 100%;
  }
}

@media screen and (max-width: 767.98px) {
  .app-shell {
    padding-top: .85rem !important;
    padding-bottom: .85rem !important;
  }

  .app-topbar {
    min-height: 58px;
    gap: 8px;
    padding: 9px 10px;
  }

  .hamburger-btn {
    flex: 0 0 auto;
  }

  .topbar-title,
  .topbar-subtitle,
  .brand-text,
  .sidebar-user strong,
  .sidebar-user span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .card-body,
  .card-header,
  .card-footer,
  .surface-card {
    padding: .75rem;
  }

  .card-header,
  .section-heading,
  .page-actions,
  .card-actions,
  .form-actions {
    align-items: stretch !important;
  }

  .card-header > *,
  .section-heading > *,
  .page-actions > *,
  .card-actions > *,
  .form-actions > * {
    min-width: 0;
  }

  .page-actions .btn,
  .form-actions .btn,
  .card-actions .btn {
    flex: 1 1 150px;
  }

  .btn-group,
  .btn-group-sm {
    width: 100%;
  }

  .btn-group > .btn,
  .btn-group-sm > .btn {
    flex: 1 1 auto;
  }

  .input-group {
    align-items: stretch;
  }

  .input-group:not(.input-group-sm) {
    flex-wrap: wrap;
  }

  .input-group:not(.input-group-sm) > .form-control,
  .input-group:not(.input-group-sm) > .form-select {
    flex: 1 1 180px;
  }

  .table-responsive,
  .table-responsive-mobile {
    overflow-x: visible;
  }

  .table-responsive:has(.mobile-scroll-table),
  .table-responsive-mobile:has(.mobile-scroll-table) {
    overflow-x: auto;
  }

  table.mobile-card-table,
  .table-responsive table.mobile-card-table {
    min-width: 0 !important;
    display: block !important;
    width: 100% !important;
    border: 0 !important;
  }

  table.mobile-card-table caption {
    display: block;
  }

  table.mobile-card-table thead {
    display: none !important;
  }

  table.mobile-card-table tbody {
    display: grid !important;
    gap: .65rem;
    width: 100%;
  }

  table.mobile-card-table tr {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: .55rem .65rem !important;
    border: 1px solid var(--py-line) !important;
    border-radius: 8px !important;
    background: #fff !important;
    box-shadow: 0 4px 12px rgba(24, 37, 43, .04) !important;
  }

  table.mobile-card-table td,
  table.mobile-card-table th {
    display: grid !important;
    grid-template-columns: minmax(92px, 38%) minmax(0, 1fr);
    gap: .65rem;
    width: 100% !important;
    padding: .38rem 0 !important;
    border: 0 !important;
    border-bottom: 1px solid #eef3f1 !important;
    text-align: right !important;
    vertical-align: top !important;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  table.mobile-card-table td:last-child,
  table.mobile-card-table th:last-child {
    border-bottom: 0 !important;
  }

  table.mobile-card-table td::before,
  table.mobile-card-table th::before {
    content: attr(data-label);
    color: var(--py-muted);
    font-weight: 800;
    text-align: left;
  }

  table.mobile-card-table td:not([data-label])::before,
  table.mobile-card-table th:not([data-label])::before,
  table.mobile-card-table td[data-label=""]::before,
  table.mobile-card-table th[data-label=""]::before {
    content: "";
  }

  table.mobile-card-table td[colspan],
  table.mobile-card-table th[colspan] {
    display: block !important;
    text-align: center !important;
  }

  table.mobile-card-table td .btn,
  table.mobile-card-table th .btn,
  table.mobile-card-table td .form-control,
  table.mobile-card-table td .form-select {
    width: 100%;
  }

  table.mobile-scroll-table,
  .table-responsive table.mobile-scroll-table,
  .table-responsive-mobile table.mobile-scroll-table {
    display: table !important;
    min-width: 680px !important;
    width: 100% !important;
    table-layout: auto;
  }

  table.mobile-scroll-table thead {
    display: table-header-group !important;
  }

  table.mobile-scroll-table tbody {
    display: table-row-group !important;
  }

  table.mobile-scroll-table tr {
    display: table-row !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  table.mobile-scroll-table th,
  table.mobile-scroll-table td {
    display: table-cell !important;
    width: auto !important;
    padding: .45rem .55rem !important;
    text-align: inherit;
  }

  table.mobile-scroll-table th::before,
  table.mobile-scroll-table td::before {
    content: none !important;
  }

  .mobile-scroll-hint {
    display: none !important;
  }

  .table-responsive:has(.mobile-scroll-table) + .mobile-scroll-hint,
  .table-responsive-mobile:has(.mobile-scroll-table) + .mobile-scroll-hint {
    display: block !important;
  }
}

@media screen and (max-width: 420px) {
  .topbar-actions {
    max-width: 36vw;
  }

  .topbar-actions .btn {
    font-size: .78rem;
  }

  table.mobile-card-table td,
  table.mobile-card-table th {
    grid-template-columns: 1fr;
    text-align: left !important;
    gap: .15rem;
  }
}

/* Admin and staff: navy operations theme */
body.theme-staff,
body.theme-admin {
  --py-primary: #12395d !important;
  --py-primary-2: #0f2742 !important;
  --py-accent: #d9a441 !important;
  --py-accent-2: #f2c96b !important;
  --py-mint: #2f80a8 !important;
  --py-soft: #eef4f9 !important;
  --py-line: #c8d7e6 !important;
  --py-text: #102033 !important;
  --py-muted: #607287 !important;
  --py-bg: #f4f7fa !important;
  --py-bg-2: #eef3f8 !important;
  --py-sidebar-start: #0f2742 !important;
  --py-sidebar-end: #12395d !important;
  --py-hero-start: #0f2742 !important;
  --py-hero-end: #12395d !important;
}

body.theme-staff,
body.theme-admin {
  background: #f4f7fa !important;
}

.theme-staff .app-sidebar,
.theme-admin .app-sidebar,
.theme-staff .public-hero,
.theme-admin .public-hero,
.theme-staff .hero-stat,
.theme-admin .hero-stat {
  background: #0f2742 !important;
  background-image: none !important;
}

.theme-staff .app-topbar,
.theme-admin .app-topbar {
  border-bottom-color: #c8d7e6 !important;
  background: #ffffff !important;
}

.theme-staff .sidebar-context span,
.theme-admin .sidebar-context span {
  color: #f2c96b !important;
}

.theme-staff .sidebar-nav a.active .nav-dot,
.theme-admin .sidebar-nav a.active .nav-dot {
  background: #f2c96b !important;
}

.theme-staff .btn-primary,
.theme-admin .btn-primary,
.theme-staff .btn-success,
.theme-admin .btn-success,
.theme-staff .btn-info,
.theme-admin .btn-info {
  background: #12395d !important;
  border-color: #12395d !important;
}

.theme-staff .btn-primary:hover,
.theme-admin .btn-primary:hover,
.theme-staff .btn-success:hover,
.theme-admin .btn-success:hover,
.theme-staff .btn-info:hover,
.theme-admin .btn-info:hover {
  background: #0f2742 !important;
  border-color: #0f2742 !important;
}

.theme-staff .btn-outline-primary,
.theme-admin .btn-outline-primary,
.theme-staff .btn-outline-success,
.theme-admin .btn-outline-success,
.theme-staff .btn-outline-info,
.theme-admin .btn-outline-info {
  color: #12395d !important;
  border-color: #12395d !important;
}

.theme-staff .btn-outline-primary:hover,
.theme-admin .btn-outline-primary:hover,
.theme-staff .btn-outline-success:hover,
.theme-admin .btn-outline-success:hover,
.theme-staff .btn-outline-info:hover,
.theme-admin .btn-outline-info:hover {
  color: #ffffff !important;
  background: #12395d !important;
  border-color: #12395d !important;
}

.theme-staff .brand-mark,
.theme-admin .brand-mark,
.theme-staff .btn-accent,
.theme-admin .btn-accent {
  background: #d9a441 !important;
  border-color: #d9a441 !important;
  color: #102033 !important;
}

@media print {
  body:not(.certificate-print-page) .athlete-list-print-sheet table {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
    border-spacing: 0 !important;
  }

  body:not(.certificate-print-page) .athlete-list-print-sheet thead {
    display: table-header-group !important;
  }

  body:not(.certificate-print-page) .athlete-list-print-sheet tbody {
    display: table-row-group !important;
  }

  body:not(.certificate-print-page) .athlete-list-print-sheet tr {
    display: table-row !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    background: transparent !important;
  }

  body:not(.certificate-print-page) .athlete-list-print-sheet th,
  body:not(.certificate-print-page) .athlete-list-print-sheet td {
    display: table-cell !important;
    width: auto !important;
    margin: 0 !important;
    border: 1px solid #111 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    padding: 1.4mm 1.8mm !important;
    text-align: left !important;
    vertical-align: middle !important;
  }

  body:not(.certificate-print-page) .athlete-list-print-sheet img,
  body:not(.certificate-print-page) .athlete-list-print-sheet svg {
    width: 9mm !important;
    height: 9mm !important;
  }
}

/* End-of-file mobile override: keep phone screens usable after all print rules. */
@media screen and (max-width: 767.98px) {
  .table-responsive,
  .table-responsive-mobile {
    overflow-x: visible !important;
  }

  .table-responsive:has(.mobile-scroll-table),
  .table-responsive-mobile:has(.mobile-scroll-table) {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  table.mobile-card-table,
  .table-responsive table.mobile-card-table,
  .table-responsive-mobile table.mobile-card-table {
    display: block !important;
    min-width: 0 !important;
    width: 100% !important;
    border: 0 !important;
  }

  table.mobile-card-table thead {
    display: none !important;
  }

  table.mobile-card-table tbody {
    display: grid !important;
    gap: .65rem !important;
    width: 100% !important;
  }

  table.mobile-card-table tr {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: .55rem .65rem !important;
    border: 1px solid var(--py-line) !important;
    border-radius: 8px !important;
    background: #fff !important;
    box-shadow: 0 4px 12px rgba(24, 37, 43, .04) !important;
  }

  table.mobile-card-table td,
  table.mobile-card-table th {
    display: grid !important;
    grid-template-columns: minmax(92px, 38%) minmax(0, 1fr) !important;
    gap: .65rem !important;
    width: 100% !important;
    padding: .38rem 0 !important;
    border: 0 !important;
    border-bottom: 1px solid #eef3f1 !important;
    text-align: right !important;
    vertical-align: top !important;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  table.mobile-card-table td:last-child,
  table.mobile-card-table th:last-child {
    border-bottom: 0 !important;
  }

  table.mobile-card-table td::before,
  table.mobile-card-table th::before {
    content: attr(data-label) !important;
    color: var(--py-muted);
    font-weight: 800;
    text-align: left;
  }

  table.mobile-card-table td:not([data-label])::before,
  table.mobile-card-table th:not([data-label])::before,
  table.mobile-card-table td[data-label=""]::before,
  table.mobile-card-table th[data-label=""]::before {
    content: "" !important;
  }

  table.mobile-card-table td[colspan],
  table.mobile-card-table th[colspan] {
    display: block !important;
    text-align: center !important;
  }

  table.mobile-scroll-table,
  .table-responsive table.mobile-scroll-table,
  .table-responsive-mobile table.mobile-scroll-table {
    display: table !important;
    min-width: 680px !important;
    width: 100% !important;
    table-layout: auto !important;
  }

  table.mobile-scroll-table thead {
    display: table-header-group !important;
  }

  table.mobile-scroll-table tbody {
    display: table-row-group !important;
  }

  table.mobile-scroll-table tr {
    display: table-row !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  table.mobile-scroll-table th,
  table.mobile-scroll-table td {
    display: table-cell !important;
    width: auto !important;
    padding: .45rem .55rem !important;
    text-align: inherit;
  }

  table.mobile-scroll-table th::before,
  table.mobile-scroll-table td::before {
    content: none !important;
  }
}

@media screen and (max-width: 420px) {
  table.mobile-card-table td,
  table.mobile-card-table th {
    grid-template-columns: 1fr !important;
    text-align: left !important;
    gap: .15rem !important;
  }
}

/* Final mobile override: this must stay at the end so older responsive table
   rules cannot turn every table into oversized blocks again. */
@media screen and (max-width: 767.98px) {
  .table-responsive,
  .table-responsive-mobile {
    overflow-x: visible !important;
  }

  .table-responsive:has(.mobile-scroll-table),
  .table-responsive-mobile:has(.mobile-scroll-table) {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  table.mobile-card-table,
  .table-responsive table.mobile-card-table,
  .table-responsive-mobile table.mobile-card-table {
    display: block !important;
    min-width: 0 !important;
    width: 100% !important;
    border: 0 !important;
  }

  table.mobile-card-table thead {
    display: none !important;
  }

  table.mobile-card-table tbody {
    display: grid !important;
    gap: .65rem !important;
    width: 100% !important;
  }

  table.mobile-card-table tr {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: .55rem .65rem !important;
    border: 1px solid var(--py-line) !important;
    border-radius: 8px !important;
    background: #fff !important;
    box-shadow: 0 4px 12px rgba(24, 37, 43, .04) !important;
  }

  table.mobile-card-table td,
  table.mobile-card-table th {
    display: grid !important;
    grid-template-columns: minmax(92px, 38%) minmax(0, 1fr) !important;
    gap: .65rem !important;
    width: 100% !important;
    padding: .38rem 0 !important;
    border: 0 !important;
    border-bottom: 1px solid #eef3f1 !important;
    text-align: right !important;
    vertical-align: top !important;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  table.mobile-card-table td:last-child,
  table.mobile-card-table th:last-child {
    border-bottom: 0 !important;
  }

  table.mobile-card-table td::before,
  table.mobile-card-table th::before {
    content: attr(data-label) !important;
    color: var(--py-muted);
    font-weight: 800;
    text-align: left;
  }

  table.mobile-card-table td:not([data-label])::before,
  table.mobile-card-table th:not([data-label])::before,
  table.mobile-card-table td[data-label=""]::before,
  table.mobile-card-table th[data-label=""]::before {
    content: "" !important;
  }

  table.mobile-card-table td[colspan],
  table.mobile-card-table th[colspan] {
    display: block !important;
    text-align: center !important;
  }

  table.mobile-scroll-table,
  .table-responsive table.mobile-scroll-table,
  .table-responsive-mobile table.mobile-scroll-table {
    display: table !important;
    min-width: 680px !important;
    width: 100% !important;
    table-layout: auto !important;
  }

  table.mobile-scroll-table thead {
    display: table-header-group !important;
  }

  table.mobile-scroll-table tbody {
    display: table-row-group !important;
  }

  table.mobile-scroll-table tr {
    display: table-row !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  table.mobile-scroll-table th,
  table.mobile-scroll-table td {
    display: table-cell !important;
    width: auto !important;
    padding: .45rem .55rem !important;
    text-align: inherit;
  }

  table.mobile-scroll-table th::before,
  table.mobile-scroll-table td::before {
    content: none !important;
  }
}

@media screen and (max-width: 420px) {
  table.mobile-card-table td,
  table.mobile-card-table th {
    grid-template-columns: 1fr !important;
    text-align: left !important;
    gap: .15rem !important;
  }
}

@media print {
  @page report-call-landscape {
    size: A4 landscape;
    margin: 7mm;
  }

  body:not(.certificate-print-page) .report-call-sheet {
    page: report-call-landscape;
    width: 277mm !important;
    max-width: 277mm !important;
    margin: 0 auto 2.4mm !important;
    padding: 0 !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    break-after: auto !important;
    page-break-after: auto !important;
  }

  body:not(.certificate-print-page) .report-call-sheet .card-body {
    padding: 1.8mm 2mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet .mb-3 {
    margin-bottom: .8mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet h2 {
    font-size: 9pt !important;
    margin-bottom: .2mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet .small,
  body:not(.certificate-print-page) .report-call-sheet .text-muted,
  body:not(.certificate-print-page) .report-call-sheet div {
    font-size: 7.2pt !important;
    line-height: 1.08 !important;
  }

  body:not(.certificate-print-page) .report-call-sheet table,
  body:not(.certificate-print-page) .report-call-sheet .table {
    font-size: 7.4pt !important;
    line-height: 1.08 !important;
    table-layout: fixed !important;
    margin-bottom: .8mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet th,
  body:not(.certificate-print-page) .report-call-sheet td {
    padding: .65mm 1mm !important;
    vertical-align: middle !important;
  }

  body:not(.certificate-print-page) .report-call-sheet img[alt="QR"] {
    width: 15mm !important;
    height: 15mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet img:not([alt="QR"]) {
    width: 6.5mm !important;
    height: 6.5mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet .mt-4 {
    margin-top: 1mm !important;
    font-size: 7.2pt !important;
  }

  body:not(.certificate-print-page) .report-call-sheet .gap-1 {
    gap: 1.2mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet .ps-4 {
    padding-left: 5mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet tr,
  body:not(.certificate-print-page) .report-call-sheet thead,
  body:not(.certificate-print-page) .report-call-sheet tbody {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}

@media (max-width: 575.98px) {
  body {
    font-size: .95rem;
  }
  .app-sidebar {
    width: min(92vw, 340px);
    padding: 14px;
  }
  .sidebar-context {
    margin: 12px 0;
    padding: 12px;
  }
  .app-topbar {
    padding: 8px 10px;
  }
  .hamburger-btn {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
  }
  .topbar-subtitle {
    display: none;
  }
  .public-hero h1 {
    font-size: clamp(1.8rem, 10vw, 2.7rem);
  }
  .public-hero p {
    font-size: .98rem;
  }
  .scoreboard-item {
    min-height: auto;
  }
  .scoreboard-item strong {
    font-size: 1.55rem;
  }
  .hero-search .btn,
  .hero-actions .btn,
  .topbar-actions .btn,
  .surface-card > .btn,
  .app-card .btn.w-100-mobile {
    width: 100%;
  }
  .d-flex.gap-2,
  .d-flex.gap-3 {
    row-gap: .5rem !important;
  }
  .form-label {
    margin-bottom: .3rem;
  }
  .form-text,
  .small {
    font-size: .82rem;
  }
  .alert {
    padding: .75rem .9rem;
  }
  .pagination {
    flex-wrap: wrap;
    gap: .25rem;
  }
  .certificate-sheet.cert-editor-preview {
    transform: scale(.27);
  }
  .cert-preview-wrap:has(.certificate-sheet.cert-editor-preview.landscape) {
    min-height: calc(210mm * .27 + 24px);
  }
  .cert-preview-wrap:has(.certificate-sheet.cert-editor-preview.portrait) {
    min-height: calc(297mm * .27 + 24px);
  }
  .certificate-text {
    touch-action: none;
  }
  .app-footer .container-fluid {
    justify-content: center !important;
    text-align: center;
  }
}

/* Athlete image crop box */
.athlete-crop-box{width:230px;max-width:100%;padding:5px;border:1px dashed var(--bs-border-color);border-radius:12px;background:#fff;touch-action:none}
.athlete-crop-box canvas{width:220px;height:220px;max-width:100%;display:block;border-radius:10px;cursor:move;background:#f8fafc}
@media print{.application-print-card{page-break-after:always}.application-print-card:last-child{page-break-after:auto}}

/* PY-Contest: single solid color theme (no gradients) */
:root,
body.theme-public,
body.theme-unit,
body.theme-staff,
body.theme-admin {
  --py-primary: #0f5f56 !important;
  --py-primary-2: #0a3f3a !important;
  --py-accent: #e85d4f !important;
  --py-accent-2: #f6b84b !important;
  --py-mint: #0f5f56 !important;
  --py-soft: #eef8f4 !important;
  --py-line: #b9ddd5 !important;
  --py-text: #172033 !important;
  --py-muted: #64748b !important;
  --py-bg: #f8fafc !important;
  --py-bg-2: #f1f5f9 !important;
  --py-sidebar-start: #0a3f3a !important;
  --py-sidebar-end: #0a3f3a !important;
  --py-hero-start: #0f5f56 !important;
  --py-hero-end: #0f5f56 !important;
}
body,
body.theme-public,
body.theme-unit,
body.theme-staff,
body.theme-admin,
.public-home,
.login-page {
  background: #f8fafc !important;
}
.app-sidebar,
.theme-public .app-sidebar,
.theme-unit .app-sidebar,
.theme-staff .app-sidebar,
.theme-admin .app-sidebar,
.public-hero,
.theme-public .public-hero,
.theme-unit .public-hero,
.theme-staff .public-hero,
.theme-admin .public-hero,
.hero-stat,
.theme-public .hero-stat,
.theme-unit .hero-stat,
.theme-staff .hero-stat,
.theme-admin .hero-stat {
  background: #0f5f56 !important;
  background-image: none !important;
}
.btn-primary,
.theme-public .btn-primary,
.theme-unit .btn-primary,
.theme-staff .btn-primary,
.theme-admin .btn-primary {
  background: #0f5f56 !important;
  background-image: none !important;
  border-color: #0f5f56 !important;
}
.btn-primary:hover,
.theme-public .btn-primary:hover,
.theme-unit .btn-primary:hover,
.theme-staff .btn-primary:hover,
.theme-admin .btn-primary:hover {
  background: #0a3f3a !important;
  border-color: #0a3f3a !important;
}
.btn-accent,
.theme-public .btn-accent,
.theme-unit .btn-accent,
.theme-staff .btn-accent,
.theme-admin .btn-accent,
.brand-mark,
.theme-public .brand-mark,
.theme-unit .brand-mark,
.theme-staff .brand-mark,
.theme-admin .brand-mark {
  background: #e85d4f !important;
  background-image: none !important;
  border-color: #e85d4f !important;
}
.app-topbar,
.app-card,
.surface-card,
.quick-links a,
.theme-public .app-card,
.theme-unit .app-card,
.theme-staff .app-card,
.theme-admin .app-card {
  background: #ffffff !important;
  background-image: none !important;
}

/* PY-Contest: บังคับหน้ารายงาน/หน้าพิมพ์ทั่วไปเป็น A4 แนวตั้ง */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  body:not(.certificate-print-page) {
    background: #ffffff !important;
    color: #111827 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body:not(.certificate-print-page).has-sidebar,
  body:not(.certificate-print-page) .app-main,
  body:not(.certificate-print-page) .app-shell {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  body:not(.certificate-print-page) .app-sidebar,
  body:not(.certificate-print-page) .app-topbar,
  body:not(.certificate-print-page) .sidebar-backdrop,
  body:not(.certificate-print-page) footer,
  body:not(.certificate-print-page) .btn,
  body:not(.certificate-print-page) .no-print,
  body:not(.certificate-print-page) form.no-print {
    display: none !important;
  }

  body:not(.certificate-print-page) .print-card,
  body:not(.certificate-print-page) .report-call-sheet,
  body:not(.certificate-print-page) .application-print-card,
  body:not(.certificate-print-page) .app-card,
  body:not(.certificate-print-page) .surface-card {
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #ffffff !important;
  }

  body:not(.certificate-print-page) .print-card,
  body:not(.certificate-print-page) .report-call-sheet,
  body:not(.certificate-print-page) .application-print-card {
    width: 190mm !important;
    max-width: 190mm !important;
    margin: 0 auto !important;
    page-break-after: always;
    break-after: page;
  }

  body:not(.certificate-print-page) .print-card:last-child,
  body:not(.certificate-print-page) .report-call-sheet:last-child,
  body:not(.certificate-print-page) .application-print-card:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  body:not(.certificate-print-page) .print-card .card-body,
  body:not(.certificate-print-page) .report-call-sheet .card-body,
  body:not(.certificate-print-page) .application-print-card .card-body {
    padding: 0 !important;
  }

  body:not(.certificate-print-page) .table-responsive {
    overflow: visible !important;
  }

  body:not(.certificate-print-page) table,
  body:not(.certificate-print-page) .table {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 10.5pt !important;
    line-height: 1.35 !important;
    page-break-inside: auto;
    break-inside: auto;
  }

  body:not(.certificate-print-page) .table > :not(caption) > * > * {
    padding: 3.5pt 4pt !important;
  }

  body:not(.certificate-print-page) thead {
    display: table-header-group;
  }

  body:not(.certificate-print-page) tfoot {
    display: table-footer-group;
  }

  body:not(.certificate-print-page) tr,
  body:not(.certificate-print-page) img,
  body:not(.certificate-print-page) .badge {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body:not(.certificate-print-page) h1,
  body:not(.certificate-print-page) h2,
  body:not(.certificate-print-page) h3,
  body:not(.certificate-print-page) h4 {
    break-after: avoid;
    page-break-after: avoid;
  }

  body:not(.certificate-print-page) .report-call-sheet {
    width: 190mm !important;
    max-width: 190mm !important;
    min-height: auto !important;
    overflow: visible !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  body:not(.certificate-print-page) .report-call-sheet .card-body {
    overflow: visible !important;
  }

  body:not(.certificate-print-page) .report-call-sheet table,
  body:not(.certificate-print-page) .report-call-sheet .table {
    table-layout: fixed !important;
    font-size: 8.6pt !important;
    line-height: 1.18 !important;
    overflow: visible !important;
  }

  body:not(.certificate-print-page) .report-call-sheet th,
  body:not(.certificate-print-page) .report-call-sheet td {
    padding: 2.2pt 2.6pt !important;
    white-space: normal !important;
    overflow: visible !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  body:not(.certificate-print-page) .report-call-sheet .text-muted {
    color: #374151 !important;
  }
}

/* Hero title size fix: keep long Thai competition names readable */
.public-hero h1,
.theme-public .public-hero h1,
.theme-unit .public-hero h1,
.theme-staff .public-hero h1,
.theme-admin .public-hero h1 {
  max-width: 760px;
  font-size: clamp(1.75rem, 2.9vw, 2.75rem) !important;
  line-height: 1.16 !important;
  letter-spacing: 0;
  word-break: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 1199.98px) {
  .public-hero h1,
  .theme-public .public-hero h1,
  .theme-unit .public-hero h1,
  .theme-staff .public-hero h1,
  .theme-admin .public-hero h1 {
    font-size: clamp(1.6rem, 3.1vw, 2.45rem) !important;
  }
}

@media (max-width: 767.98px) {
  .public-hero h1,
  .theme-public .public-hero h1,
  .theme-unit .public-hero h1,
  .theme-staff .public-hero h1,
  .theme-admin .public-hero h1 {
    font-size: clamp(1.42rem, 5.8vw, 1.95rem) !important;
    line-height: 1.15 !important;
  }
}

/* Single event logo branding: use only the competition/event logo, not a separate system logo. */
.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  flex: 0 0 auto;
}
.brand-logo--login {
  width: 56px;
  height: 56px;
  border-radius: 14px;
}
.sidebar-brand-link .brand-logo + .brand-text {
  margin-left: .25rem;
}
@media print {
  .brand-logo { box-shadow: none; }
}


/* Participant card / QR print */
.card-grid-print{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:12px}.participant-card-print{border:1px solid #d0d7de;border-radius:12px;background:#fff;overflow:hidden;break-inside:avoid}.pcard-head{background:var(--bs-primary,#0d6efd);color:#fff;font-weight:700;padding:8px 12px;text-align:center}.pcard-body{display:flex;gap:10px;align-items:center;padding:12px}.pcard-photo{width:78px;height:78px;border:1px solid #ddd;border-radius:8px;display:flex;align-items:center;justify-content:center;overflow:hidden;background:#f8f9fa;color:#adb5bd;font-size:.8rem}.pcard-photo img{width:100%;height:100%;object-fit:cover}.pcard-info{flex:1;min-width:0}.pcard-qr{width:86px;height:86px;object-fit:contain}@media print{.card-grid-print{grid-template-columns:1fr 1fr;gap:8mm}.participant-card-print{page-break-inside:avoid;border:1px solid #999}.pcard-head{background:#111!important;color:#fff!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}.pcard-qr{width:30mm;height:30mm}}
.live-pulse{display:inline-block;width:.65rem;height:.65rem;background:#dc3545;border-radius:50%;margin-right:.35rem;animation:pyPulse 1.2s infinite}@keyframes pyPulse{0%{opacity:.25}50%{opacity:1}100%{opacity:.25}}
.round-flow-list{display:grid;gap:14px}.round-flow-event{border:1px solid #d9e2e5;border-radius:8px;background:#fff;overflow:hidden}.round-flow-title{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px;border-bottom:1px solid #e6ecef;background:#f8fafc}.round-flow-board{display:flex;gap:34px;align-items:stretch;overflow-x:auto;padding:14px;scrollbar-width:thin}.round-flow-column{position:relative;flex:0 0 250px;display:flex;flex-direction:column;gap:10px}.round-flow-column:not(:last-child)::after{content:"";position:absolute;right:-27px;top:38px;width:20px;height:2px;background:#9fb1b8}.round-flow-column:not(:last-child)::before{content:"";position:absolute;right:-29px;top:33px;border-left:8px solid #9fb1b8;border-top:6px solid transparent;border-bottom:6px solid transparent}.round-flow-round{border:1px solid #b9c8ce;border-left:4px solid var(--py-primary);border-radius:8px;padding:9px 10px;background:#fdfefe;min-height:58px}.round-flow-round-name{font-weight:700;color:#17333d}.round-flow-round-meta{font-size:.82rem;color:#667985;margin-top:2px}.round-flow-rules{display:grid;gap:8px}.round-flow-rule{border:1px solid #d8e3e7;border-radius:8px;background:#f7fbfb;padding:8px 10px;min-height:104px}.round-flow-rule-source{font-size:.78rem;font-weight:700;color:#2f6f7a;text-transform:none}.round-flow-rule-main{font-weight:700;margin-top:2px}.round-flow-rule-target{margin-top:6px;color:#17333d}.round-flow-rule-sub{font-size:.78rem;color:#6b7b84;margin-top:3px}.round-flow-empty{border:1px dashed #c8d5da;border-radius:8px;color:#7b8b94;background:#fbfcfd;padding:12px;font-size:.9rem;min-height:104px;display:flex;align-items:center}
@media (max-width: 768px){.round-flow-title{display:block}.round-flow-board{gap:26px;padding:12px}.round-flow-column{flex-basis:230px}.round-flow-column:not(:last-child)::after{right:-22px}.round-flow-column:not(:last-child)::before{right:-24px}}
@media print{.round-flow-board{overflow:visible;gap:8mm}.round-flow-column{flex:1 1 0;min-width:42mm}.round-flow-column::before,.round-flow-column::after{display:none}.round-flow-event{break-inside:avoid;page-break-inside:avoid}.round-flow-rule,.round-flow-round{border-color:#111;background:#fff}}

/* Athlete modal: long forms must be scrollable on desktop and mobile */
.athlete-modal-dialog .modal-content {
    max-height: calc(100vh - 1rem);
}
.athlete-modal-dialog .modal-body {
    max-height: calc(100vh - 10rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.athlete-modal-dialog .modal-footer,
.athlete-modal-dialog .modal-header {
    flex-shrink: 0;
}
@media (max-width: 576px) {
    .athlete-modal-dialog {
        margin: .5rem;
    }
    .athlete-modal-dialog .modal-body {
        max-height: calc(100vh - 8.5rem);
        padding: .85rem;
    }
    .athlete-modal-dialog .form-select,
    .athlete-modal-dialog .form-control,
    .athlete-modal-dialog .btn {
        min-height: 44px;
    }
}

/* Global modal scrolling: every add/edit modal must fit smaller screens */
.modal {
  z-index: 1060;
}
.modal-backdrop {
  z-index: 1050;
}
.modal.show {
  pointer-events: auto;
}
.modal.show .modal-dialog,
.modal.show .modal-content {
  pointer-events: auto;
}
.modal-dialog {
  max-height: calc(100dvh - 1rem);
}
.modal-content {
  max-height: calc(100dvh - 1rem);
  display: flex;
  flex-direction: column;
}
.modal-header,
.modal-footer {
  flex: 0 0 auto;
}
.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 576px) {
  .modal-dialog {
    max-height: calc(100dvh - 3.5rem);
  }
  .modal-content {
    max-height: calc(100dvh - 3.5rem);
  }
}

/* Athlete ID card form */
.athlete-id-card-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(64mm,1fr));gap:8mm;align-items:start}
.athlete-id-card-form{position:relative;width:59mm;height:90mm;border:1px solid #111;background-color:#fff;background-position:center;background-size:100% 100%;background-repeat:no-repeat;color:#111;padding:0;font-family:var(--py-font-main);page-break-inside:avoid;break-inside:avoid;margin:auto;font-size:8.4pt;line-height:1.18;overflow:hidden}
.athlete-id-card-form.has-card-bg{-webkit-print-color-adjust:exact;print-color-adjust:exact}
.athlete-id-card-form.has-card-bg::before{content:"";position:absolute;inset:0;background:rgba(255,255,255,.18);pointer-events:none;z-index:0}
.athlete-id-card-form.has-card-bg>*{z-index:1}
.athlete-id-card-form.has-card-bg .athlete-id-title,
.athlete-id-card-form.has-card-bg .athlete-card-event-title,
.athlete-id-card-form.has-card-bg .athlete-card-lines,
.athlete-id-card-form.has-card-bg .athlete-card-sign{z-index:1}
.athlete-id-title{position:absolute;left:2mm;right:20mm;top:16mm;height:6mm;text-align:center;font-weight:700;font-size:8.2pt;line-height:1.08;margin:0;padding:0;display:flex;align-items:flex-start;justify-content:center}
.athlete-code-boxes{position:absolute;left:3mm;right:20mm;top:21.8mm;display:flex;justify-content:center;gap:1mm}
.athlete-code-boxes span{display:inline-flex;align-items:center;justify-content:center;width:5mm;height:6.2mm;border:1px solid #555;font-weight:700;font-size:9.4pt;line-height:1}
.athlete-card-photo{position:absolute;right:2mm;top:5mm;width:18mm;height:23mm;border:1px solid #111;display:flex;align-items:center;justify-content:center;overflow:hidden;background:#fff;color:#333;font-size:7.2pt;text-align:center;z-index:2}
.athlete-card-photo img{width:100%;height:100%;object-fit:cover}
.athlete-card-event-title{position:absolute;left:5mm;right:4mm;top:31.8mm;height:10.5mm;text-align:center;font-size:7.6pt;line-height:1.08;font-weight:700;margin:0;padding:0 1mm;display:flex;flex-direction:column;justify-content:center}
.athlete-card-lines{position:absolute;left:5mm;right:4mm;top:43.8mm;margin:0;padding:0;font-size:7.45pt;line-height:1.14}
.athlete-card-lines span{display:inline-block;min-width:0;border-bottom:0;padding:0 .45mm}
.athlete-event-lines{display:grid;grid-template-columns:1fr;column-gap:4mm;margin-top:.5mm}
.athlete-event-lines div{border-bottom:1px dotted #222;min-height:3mm;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:6.35pt;line-height:1.08}
.athlete-card-sign{position:absolute;left:0;right:0;bottom:4.5mm;text-align:center;margin:0;font-size:6.8pt}
.athlete-card-sign span{display:inline-block;margin-top:1mm}
.modal .modal-body{max-height:calc(100vh - 190px);overflow-y:auto}
.modal-dialog-scrollable .modal-body{max-height:calc(100vh - 190px);overflow-y:auto}

/* Global loading overlay */
.app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(2px);
}
.app-loading-overlay.show {
  display: flex;
}
.app-loading-dialog {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: min(92vw, 460px);
  padding: 18px 20px;
  border: 1px solid rgba(42, 157, 143, .16);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .22);
}
.app-loading-dialog strong,
.app-loading-dialog span {
  display: block;
}
.app-loading-dialog strong {
  color: var(--py-dark);
}
.app-loading-dialog span {
  color: #64748b;
  font-size: .92rem;
}
.app-loading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.app-notice-modal .modal-content {
  border-radius: 8px;
}
.app-notice-modal .app-notice-message {
  white-space: pre-line;
  color: #334155;
}
.app-notice-modal .app-notice-badge {
  font-weight: 600;
}
.app-network-notice {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 3100;
  display: none;
  width: min(92vw, 520px);
  transform: translateX(-50%);
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, .12);
  border-left: 5px solid #0f5f56;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .2);
  font-size: .94rem;
}
.app-network-notice.show {
  display: block;
}
.app-network-notice.warning {
  border-left-color: #e85d4f;
}
.app-network-notice.danger {
  border-left-color: #dc2626;
}
.app-network-notice.success {
  border-left-color: #16a34a;
}

@media print{
  .athlete-id-card-grid{grid-template-columns:repeat(3,59mm);gap:3mm 4.5mm;display:grid!important}
  .athlete-id-card-form{width:59mm;height:90mm;margin:0;border:1px solid #000;-webkit-print-color-adjust:exact;print-color-adjust:exact}
}
@media (max-width: 576px){.athlete-id-card-form{transform:scale(.92);transform-origin:top center;margin-bottom:-8mm}.athlete-id-card-grid{grid-template-columns:1fr}}

.athlete-photo-panel{width:190mm;margin:0 auto 12mm;background:#fff;color:#111;padding:8mm;font-family:var(--py-font-main);break-inside:avoid;page-break-inside:avoid}
.photo-panel-header{text-align:center;line-height:1.35;margin-bottom:6mm}
.photo-panel-header h2{font-size:16pt;margin:0 0 1mm;font-weight:700}
.photo-panel-table{width:100%;border-collapse:collapse;table-layout:fixed;font-size:9pt}
.photo-panel-table th,.photo-panel-table td{border:1px solid #111;padding:2mm;vertical-align:top;overflow-wrap:anywhere}
.photo-panel-table th{text-align:center;font-weight:700}
.photo-panel-table tbody tr{height:45mm}
.panel-photo{width:18mm;height:23mm;border:1px solid #111;margin:0 auto 3mm;display:flex;align-items:center;justify-content:center;overflow:hidden;background:#fff}
.panel-photo img{width:100%;height:100%;object-fit:cover}
.panel-name{border-bottom:1px dotted #111;margin-top:1.5mm;min-height:4mm;font-size:8.5pt}
.panel-code{letter-spacing:2px;text-align:center;margin-top:1.5mm;font-family:var(--py-font-main)}
.panel-events div{border-bottom:1px dotted #111;min-height:6mm;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.signature-line{border-bottom:1px dotted #111;height:25mm;margin-top:10mm}
.signature-stack{display:flex;flex-direction:column;gap:4mm;margin-top:5mm}
.signature-stack span{display:block;border-bottom:1px dotted #111;height:4mm}
.result-time-parts select{min-width:72px}

/* Unit printouts: fit report/application sheets to the page without scrollbars */
.unit-print-sheet {
  max-width: 100%;
  overflow: visible !important;
}
.unit-print-sheet .card-body {
  max-width: 100%;
  overflow: visible !important;
}
.unit-print-sheet table,
.unit-print-sheet .table {
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed;
}
.unit-print-sheet th,
.unit-print-sheet td {
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.unit-print-sheet .d-flex {
  min-width: 0;
}
.unit-print-sheet .gap-2 {
  gap: .35rem !important;
}
.print-table-block {
  width: 100%;
  max-width: 100%;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.print-table-block > .card-body {
  padding: 0;
}
.print-table-block table,
.print-table-block .table {
  background: #fff;
}
@media print{
  .app-table-search {
    display: none !important;
  }
  html,
  body {
    overflow: visible !important;
  }
  .unit-print-sheet {
    width: 190mm !important;
    max-width: 190mm !important;
    overflow: visible !important;
  }
  .unit-print-sheet,
  .unit-print-sheet *,
  .report-call-sheet,
  .report-call-sheet * {
    max-height: none !important;
    overflow: visible !important;
    scrollbar-width: none !important;
  }
  .unit-print-sheet::-webkit-scrollbar,
  .unit-print-sheet *::-webkit-scrollbar,
  .report-call-sheet::-webkit-scrollbar,
  .report-call-sheet *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  .unit-print-sheet .table-responsive {
    overflow: visible !important;
  }
  .unit-print-sheet table,
  .unit-print-sheet .table {
    table-layout: fixed !important;
  }
  .athlete-photo-panel{width:190mm!important;margin:0 auto!important;padding:0!important;page-break-after:always;break-after:page}
  .athlete-photo-panel:last-child{page-break-after:auto;break-after:auto}
  .photo-panel-table{font-size:8.3pt}
  .photo-panel-table th,.photo-panel-table td{padding:1.4mm!important}
  .photo-panel-table tbody tr{height:40mm}
}

/* Final print hardening: keep every printable page clean and paper-safe. */
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }

  html,
  body {
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: #fff !important;
    color: #111 !important;
  }

  body:not(.certificate-print-page) {
    font-size: 10pt !important;
    line-height: 1.25 !important;
  }

  body:not(.certificate-print-page) .app-frame,
  body:not(.certificate-print-page) .app-main,
  body:not(.certificate-print-page) .app-shell,
  body:not(.certificate-print-page) main,
  body:not(.certificate-print-page) .container,
  body:not(.certificate-print-page) .container-fluid {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body:not(.certificate-print-page) .app-sidebar,
  body:not(.certificate-print-page) .app-topbar,
  body:not(.certificate-print-page) .sidebar-backdrop,
  body:not(.certificate-print-page) .app-footer,
  body:not(.certificate-print-page) .no-print,
  body:not(.certificate-print-page) .app-table-search,
  body:not(.certificate-print-page) .app-loading-overlay,
  body:not(.certificate-print-page) .modal,
  body:not(.certificate-print-page) .modal-backdrop,
  body:not(.certificate-print-page) .tooltip,
  body:not(.certificate-print-page) .popover {
    display: none !important;
  }

  body:not(.certificate-print-page) .app-card,
  body:not(.certificate-print-page) .surface-card,
  body:not(.certificate-print-page) .card {
    box-shadow: none !important;
    border-radius: 0 !important;
    background: #fff !important;
  }

  body:not(.certificate-print-page) .table-responsive,
  body:not(.certificate-print-page) .table-responsive-mobile,
  body:not(.certificate-print-page) .card,
  body:not(.certificate-print-page) .card-body,
  body:not(.certificate-print-page) .app-card,
  body:not(.certificate-print-page) .surface-card {
    max-height: none !important;
    overflow: visible !important;
    scrollbar-width: none !important;
  }

  body:not(.certificate-print-page) *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  body:not(.certificate-print-page) table,
  body:not(.certificate-print-page) .table {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 0 !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
  }

  body:not(.certificate-print-page) th,
  body:not(.certificate-print-page) td {
    white-space: normal !important;
    overflow: visible !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    color: #111 !important;
  }

  body:not(.certificate-print-page) thead {
    display: table-header-group !important;
  }

  body:not(.certificate-print-page) tfoot {
    display: table-footer-group !important;
  }

  body:not(.certificate-print-page) tr,
  body:not(.certificate-print-page) img,
  body:not(.certificate-print-page) .badge,
  body:not(.certificate-print-page) .participant-card-print,
  body:not(.certificate-print-page) .athlete-id-card-form,
  body:not(.certificate-print-page) .athlete-photo-panel {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  body:not(.certificate-print-page) .print-card,
  body:not(.certificate-print-page) .unit-print-sheet,
  body:not(.certificate-print-page) .report-call-sheet,
  body:not(.certificate-print-page) .application-print-card,
  body:not(.certificate-print-page) .athlete-photo-panel {
    width: 194mm !important;
    max-width: 194mm !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 0 !important;
    break-after: page;
    page-break-after: always;
  }

  body:not(.certificate-print-page) .print-card:last-child,
  body:not(.certificate-print-page) .unit-print-sheet:last-child,
  body:not(.certificate-print-page) .report-call-sheet:last-child,
  body:not(.certificate-print-page) .application-print-card:last-child,
  body:not(.certificate-print-page) .athlete-photo-panel:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  body:not(.certificate-print-page) .print-card .card-body,
  body:not(.certificate-print-page) .unit-print-sheet .card-body,
  body:not(.certificate-print-page) .report-call-sheet .card-body,
  body:not(.certificate-print-page) .application-print-card .card-body {
    padding: 0 !important;
  }

  body:not(.certificate-print-page) .report-call-sheet table,
  body:not(.certificate-print-page) .report-call-sheet .table,
  body:not(.certificate-print-page) .unit-print-sheet table,
  body:not(.certificate-print-page) .unit-print-sheet .table {
    font-size: 8.4pt !important;
    line-height: 1.16 !important;
  }

  body:not(.certificate-print-page) .report-call-sheet th,
  body:not(.certificate-print-page) .report-call-sheet td,
  body:not(.certificate-print-page) .unit-print-sheet th,
  body:not(.certificate-print-page) .unit-print-sheet td {
    padding: 2pt 2.4pt !important;
  }

  body:not(.certificate-print-page) .athlete-id-card-grid {
    width: 225mm !important;
    grid-template-columns: repeat(3, 59mm) !important;
    gap: 5mm !important;
    margin: 0 auto !important;
  }

  body:not(.certificate-print-page) .athlete-id-card-form {
    width: 59mm !important;
    height: 90mm !important;
    margin: 0 !important;
  }

  body:not(.certificate-print-page) .card-grid-print {
    grid-template-columns: 1fr 1fr !important;
    gap: 6mm !important;
  }

  body:not(.certificate-print-page) a[href]::after {
    content: "" !important;
  }
}

@media print {
  body:not(.certificate-print-page) {
    page: app-print;
  }

  .certificate-sheet.landscape {
    page: certificate-landscape;
  }

  .certificate-sheet.portrait {
    page: certificate-portrait;
  }

  @page app-print {
    size: A4 portrait;
    margin: 8mm;
  }

  @page certificate-landscape {
    size: A4 landscape;
    margin: 0;
  }

  @page certificate-portrait {
    size: A4 portrait;
    margin: 0;
  }
}

/* Public visitor counter */
.usage-compact-widget {
  margin: 0 0 18px;
}
.usage-compact-heading {
  margin-bottom: 14px;
}
.usage-compact-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}
.usage-compact-list div {
  min-height: 96px;
  padding: 14px;
  border: 1px solid rgba(42, 157, 143, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(42, 157, 143, 0.08), rgba(255, 255, 255, 0.94));
}
.usage-compact-list dt,
.usage-compact-list dd {
  margin: 0;
}
.usage-compact-list dt {
  min-height: 2.5em;
  color: #5f6f76;
  font-size: 0.9rem;
  font-weight: 700;
}
.usage-compact-list dd {
  margin-top: 10px;
  color: var(--py-primary);
  font-size: 1.85rem;
  font-weight: 850;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 992px) {
  .usage-compact-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 576px) {
  .usage-compact-list {
    grid-template-columns: 1fr;
  }
  .usage-compact-list div {
    min-height: 84px;
  }
}

/* Flat UI mode: remove decorative shadows from cards, blocks, bars, and controls. */
*,
*::before,
*::after {
  box-shadow: none !important;
  text-shadow: none !important;
}

:focus-visible {
  outline: 2px solid var(--py-accent-2);
  outline-offset: 2px;
}

.topbar-actions .btn {
  flex: 0 0 auto;
  width: auto;
}

.event-ref-code {
  display: block;
  margin-top: .12rem;
  color: #94a3b8;
  font-size: .72em;
  font-weight: 400 !important;
  line-height: 1.1;
  letter-spacing: 0;
  white-space: nowrap;
}

.event-ref-name {
  display: inline;
  color: inherit;
}

.event-ref-extra {
  color: #94a3b8;
  font-size: .84em;
  font-weight: 400;
}

.parade-sheet-form {
  max-width: 980px;
}

.parade-sheet-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 4px;
}

.parade-sheet-title {
  margin: 0;
  font-weight: 700;
}

.parade-sheet-heading .btn {
  flex: 0 0 auto;
}

.parade-sheet-table th,
.parade-sheet-table td {
  vertical-align: middle;
}

.parade-sheet-table th {
  background: #eef4fb;
  font-size: .82rem;
  font-weight: 700;
}

.parade-sheet-table th,
.parade-sheet-table td {
  border-color: #9aa7b3;
}

.parade-sheet-table .form-control {
  min-height: 34px;
  border-color: #d0d7de;
  box-shadow: none;
}

.parade-sheet-table textarea.form-control {
  resize: vertical;
}

@media (max-width: 575.98px) {
  .parade-sheet-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .parade-sheet-heading .btn {
    width: 100%;
  }
}

/* Force mobile content to fit within viewport and prevent horizontal scrolling */
@media (max-width: 991.98px) {
  html, body, .app-main, .app-shell, .app-frame {
    max-width: 100vw;
    overflow-x: hidden;
  }
  
  img, video, canvas, iframe {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* Responsive Table to Cards for mobile */
@media (max-width: 767.98px) {
  table, .table-responsive table {
    display: block;
    border: 0;
    width: 100%;
  }
  table thead, .table-responsive thead {
    display: none;
  }
  table tbody, .table-responsive tbody {
    display: block;
    width: 100%;
  }
  table tr, .table-responsive tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid var(--py-line);
    border-radius: 8px;
    background: #fff;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(24, 37, 43, 0.04);
    width: 100%;
  }
  table td, table th, .table-responsive td, .table-responsive th {
    display: block;
    text-align: left;
    border: none !important;
    border-bottom: 1px solid #eef8f4 !important;
    padding: 10px 8px !important;
    word-break: break-word;
    width: 100%;
  }
  table td:last-child, table th:last-child, .table-responsive td:last-child, .table-responsive th:last-child {
    border-bottom: none !important;
  }
  
  /* Layout for table cells that have data-label attributes */
  table td[data-label], table th[data-label], .table-responsive td[data-label], .table-responsive th[data-label] {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
  }
  table td[data-label]::before, table th[data-label]::before, .table-responsive td[data-label]::before, .table-responsive th[data-label]::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--py-muted);
    text-align: left;
    margin-right: 15px;
    flex-shrink: 0;
  }
}

@media print {
  body:not(.certificate-print-page) .report-call-sheet {
    page: report-call-landscape;
    display: inline-block !important;
    vertical-align: top !important;
    width: 136mm !important;
    max-width: 136mm !important;
    margin: 0 2mm 2mm 0 !important;
    padding: 0 !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    break-after: auto !important;
    page-break-after: auto !important;
  }

  body:not(.certificate-print-page) .report-call-sheet .card-body {
    padding: 1.5mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet .mb-3 {
    margin-bottom: .6mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet h2 {
    font-size: 8.6pt !important;
    margin-bottom: .2mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet .small,
  body:not(.certificate-print-page) .report-call-sheet .text-muted,
  body:not(.certificate-print-page) .report-call-sheet div {
    font-size: 6.8pt !important;
    line-height: 1.06 !important;
  }

  body:not(.certificate-print-page) .report-call-sheet table,
  body:not(.certificate-print-page) .report-call-sheet .table {
    font-size: 7pt !important;
    line-height: 1.06 !important;
    table-layout: fixed !important;
    margin-bottom: .6mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet th,
  body:not(.certificate-print-page) .report-call-sheet td {
    padding: .45mm .7mm !important;
    vertical-align: middle !important;
  }

  body:not(.certificate-print-page) .report-call-sheet img[alt="QR"] {
    width: 15mm !important;
    height: 15mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet img:not([alt="QR"]) {
    width: 5.8mm !important;
    height: 5.8mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet .mt-4 {
    margin-top: .8mm !important;
    font-size: 6.8pt !important;
  }

  body:not(.certificate-print-page) .report-call-sheet tr,
  body:not(.certificate-print-page) .report-call-sheet thead,
  body:not(.certificate-print-page) .report-call-sheet tbody {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}

@media print {
  @page print-table-landscape {
    size: A4 landscape;
    margin: 8mm;
  }

  body:not(.certificate-print-page) .print-table-sheet,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet,
  body:not(.certificate-print-page) .application-print-card.print-table-sheet {
    page: print-table-landscape;
    display: block !important;
    width: 281mm !important;
    max-width: 281mm !important;
    margin: 0 auto 4mm !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    break-after: auto !important;
    page-break-after: auto !important;
  }

  body:not(.certificate-print-page) .print-table-sheet .card-body,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .card-body,
  body:not(.certificate-print-page) .application-print-card.print-table-sheet .card-body {
    padding: 0 !important;
  }

  body:not(.certificate-print-page) .print-table-sheet table,
  body:not(.certificate-print-page) .print-table-sheet .table {
    width: 100% !important;
    table-layout: fixed !important;
    font-size: 8.6pt !important;
    line-height: 1.16 !important;
    margin-bottom: 2mm !important;
  }

  body:not(.certificate-print-page) .print-table-sheet th,
  body:not(.certificate-print-page) .print-table-sheet td {
    padding: 1.8mm 2mm !important;
    vertical-align: middle !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  body:not(.certificate-print-page) .print-table-sheet h2 {
    font-size: 14pt !important;
    line-height: 1.2 !important;
    margin-bottom: 1mm !important;
  }

  body:not(.certificate-print-page) .print-table-sheet div,
  body:not(.certificate-print-page) .print-table-sheet .small,
  body:not(.certificate-print-page) .print-table-sheet .text-muted {
    font-size: 8.4pt !important;
    line-height: 1.16 !important;
  }

  body:not(.certificate-print-page) .print-table-sheet img[alt="QR"] {
    width: 18mm !important;
    height: 18mm !important;
  }

  body:not(.certificate-print-page) .print-table-sheet img:not([alt="QR"]) {
    width: 8mm !important;
    height: 8mm !important;
  }
}

.report-form-sheet {
  width: 100%;
  max-width: 980px;
  margin: 0 auto 18px;
  padding: 28px 26px 16px;
  background: #fff;
  color: #111;
  font-family: var(--py-font-main);
  font-size: 14px;
  line-height: 1.35;
  border: 0;
  box-shadow: none;
  break-inside: avoid;
  page-break-inside: avoid;
}
.report-form-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 18px;
  align-items: start;
  margin-bottom: 14px;
}
.report-form-meta {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.report-form-title {
  font-size: 15px;
}
.report-form-title span {
  margin-left: 4px;
}
.report-form-qr {
  width: 132px;
  min-height: 112px;
  border: 1px solid #111;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #fff;
  padding: 5px;
}
.report-form-qr img {
  width: 96px;
  height: 96px;
  object-fit: contain;
}
.report-form-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin: 0;
}
.report-form-table th,
.report-form-table td {
  border: 1px solid #111;
  padding: 3px 7px;
  height: 20px;
  font-weight: 400;
  vertical-align: middle;
}
.report-form-table th {
  text-align: left;
}
.report-form-no {
  width: 34px;
  text-align: center !important;
}
.report-form-bib {
  width: 95px;
  text-align: center !important;
}
.report-form-photo-col {
  width: 42px;
  text-align: center !important;
}
.report-form-photo {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border: 1px solid #111;
  border-radius: 2px;
  display: inline-block;
}
.report-form-name {
  width: 30%;
}
.report-form-leg {
  width: 72px;
  text-align: center !important;
}
.report-form-sequence {
  width: 72px;
  text-align: center !important;
}
.report-form-type {
  width: 90px;
}
.report-form-qr-col {
  width: 72px;
  text-align: center !important;
}
.report-form-code {
  width: 150px;
}
.report-form-qr-cell {
  text-align: center !important;
  padding: 1px !important;
}
.report-form-qr-cell img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.report-form-code-cell {
  font-family: var(--py-font-main);
  font-size: 9px;
  line-height: 1.05;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.report-form-individual-name {
  width: 60%;
}
.report-form-individual-qr {
  width: 32%;
  text-align: center !important;
}
.report-form-individual-qr-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.report-form-individual-qr-cell img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 auto;
}
.report-form-individual-qr-cell span {
  font-family: var(--py-font-main);
  font-size: 9px;
  line-height: 1.05;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.report-form-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  min-height: 34px;
}
.report-form-divider {
  text-align: center;
}
.report-form-officer-sign {
  text-align: right;
  justify-self: end;
  width: 100%;
}

.qr-scanner-box {
  position: relative;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 10;
  margin: 0 auto;
  background: #0f172a;
  border: 1px solid #cbd5e1;
  overflow: hidden;
}
.qr-scanner-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.qr-scanner-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-align: center;
  padding: 1rem;
  background: rgba(15, 23, 42, .92);
}
.report-form-sign-line {
  display: inline-block;
  width: min(260px, 58%);
  border-bottom: 1px dotted #111;
  height: 1.2em;
  vertical-align: baseline;
}

@media print {
  @page report-form-portrait {
    size: A4 portrait;
    margin: 0;
  }

  body.report-form-print-page:not(.certificate-print-page) {
    width: 210mm !important;
    min-width: 210mm !important;
    max-width: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body.report-form-print-page:not(.certificate-print-page) .app-main,
  body.report-form-print-page:not(.certificate-print-page) .app-shell,
  body.report-form-print-page:not(.certificate-print-page) main,
  body.report-form-print-page:not(.certificate-print-page) .container,
  body.report-form-print-page:not(.certificate-print-page) .container-fluid {
    width: 210mm !important;
    max-width: 210mm !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body:not(.certificate-print-page) .report-form-sheet {
    page: report-form-portrait;
    box-sizing: border-box !important;
    width: 210mm !important;
    max-width: 210mm !important;
    min-height: 0 !important;
    margin: 0 0 4mm !important;
    padding: 5mm 7mm 4mm !important;
    display: block !important;
    background: #fff !important;
    color: #111 !important;
    box-shadow: none !important;
    border: 0 !important;
    break-after: auto !important;
    page-break-after: auto !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body:not(.certificate-print-page) .report-form-sheet:last-child {
    break-after: auto !important;
    page-break-after: auto !important;
  }

  body:not(.certificate-print-page) .report-form-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 30mm !important;
    gap: 4mm !important;
    margin-bottom: 2.5mm !important;
  }

  body:not(.certificate-print-page) .report-form-meta {
    gap: 1mm !important;
  }

  body:not(.certificate-print-page) .report-form-sheet,
  body:not(.certificate-print-page) .report-form-sheet div,
  body:not(.certificate-print-page) .report-form-sheet span,
  body:not(.certificate-print-page) .report-form-sheet th,
  body:not(.certificate-print-page) .report-form-sheet td {
    font-size: 10.5pt !important;
    line-height: 1.12 !important;
  }

  body:not(.certificate-print-page) .report-form-title {
    font-size: 11pt !important;
  }

  body:not(.certificate-print-page) .report-form-qr {
    width: 30mm !important;
    min-height: 26mm !important;
    padding: 1mm !important;
  }

  body:not(.certificate-print-page) .report-form-qr img {
    width: 22mm !important;
    height: 22mm !important;
  }


  body:not(.certificate-print-page) .report-form-table th,
  body:not(.certificate-print-page) .report-form-table td {
    border: .35mm solid #111 !important;
    padding: .45mm 1mm .25mm !important;
    height: 7mm !important;
    vertical-align: middle !important;
  }

  body:not(.certificate-print-page) .report-form-no {
    width: 9mm !important;
  }

  body:not(.certificate-print-page) .report-form-bib {
    width: 24mm !important;
    text-align: center !important;
  }

  body:not(.certificate-print-page) .report-form-photo-col {
    width: 10mm !important;
    text-align: center !important;
  }

  body:not(.certificate-print-page) .report-form-photo {
    width: 6.5mm !important;
    height: 6.5mm !important;
    object-fit: cover !important;
    border: .25mm solid #111 !important;
    border-radius: .8mm !important;
  }

  body:not(.certificate-print-page) .report-form-type {
    width: 22mm !important;
  }

  body:not(.certificate-print-page) .report-form-leg {
    width: 9mm !important;
    text-align: center !important;
  }

  body:not(.certificate-print-page) .report-form-sequence {
    width: 22mm !important;
    text-align: center !important;
  }

  body:not(.certificate-print-page) .report-form-name {
    width: 115mm !important;
  }

  body:not(.certificate-print-page) .report-form-qr-col {
    width: 14mm !important;
    text-align: center !important;
  }

  body:not(.certificate-print-page) .report-form-code {
    width: 46mm !important;
  }

  body:not(.certificate-print-page) .report-form-qr-cell img {
    width: 10mm !important;
    height: 10mm !important;
  }

  body:not(.certificate-print-page) .report-form-code-cell {
    font-size: 5.9pt !important;
    line-height: 1.02 !important;
  }

  body:not(.certificate-print-page) .report-form-individual-name {
    width: 161mm !important;
  }

  body:not(.certificate-print-page) .report-form-individual-qr {
    width: 60mm !important;
  }

  body:not(.certificate-print-page) .report-form-individual-qr-cell {
    display: flex !important;
    align-items: center !important;
    gap: 1.6mm !important;
  }

  body:not(.certificate-print-page) .report-form-individual-qr-cell img {
    width: 10mm !important;
    height: 10mm !important;
  }

  body:not(.certificate-print-page) .report-form-individual-qr-cell span {
    font-size: 5.9pt !important;
    line-height: 1.02 !important;
  }

  body:not(.certificate-print-page) .report-form-signatures {
    margin-top: 2.5mm !important;
    padding-top: 0 !important;
    min-height: 7mm !important;
    align-items: end !important;
  }

  body:not(.certificate-print-page) .report-form-sign-line {
    width: 62mm !important;
    height: 4mm !important;
    border-bottom: .35mm dotted #111 !important;
  }

  body:not(.certificate-print-page) .report-form-table {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
    border-spacing: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
  }

  body:not(.certificate-print-page) .report-form-table thead {
    display: table-header-group !important;
  }

  body:not(.certificate-print-page) .report-form-table tbody {
    display: table-row-group !important;
  }

  body:not(.certificate-print-page) .report-form-table tr {
    display: table-row !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    background: transparent !important;
  }

  body:not(.certificate-print-page) .report-form-table th,
  body:not(.certificate-print-page) .report-form-table td {
    display: table-cell !important;
    width: auto !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    text-align: left !important;
    vertical-align: middle !important;
  }

  body:not(.certificate-print-page) .report-form-table .report-form-no {
    width: 9mm !important;
    text-align: center !important;
  }

  body:not(.certificate-print-page) .report-form-table .report-form-bib {
    width: 24mm !important;
    text-align: center !important;
   }

  body:not(.certificate-print-page) .report-form-table .report-form-photo-col {
    width: 10mm !important;
    text-align: center !important;
  }

  body:not(.certificate-print-page) .report-form-table .report-form-leg {
    width: 9mm !important;
    text-align: center !important;
  }

  body:not(.certificate-print-page) .report-form-table .report-form-sequence {
    width: 22mm !important;
    text-align: center !important;
  }

  body:not(.certificate-print-page) .report-form-table .report-form-type {
    width: 22mm !important;
  }

  body:not(.certificate-print-page) .report-form-table .report-form-name {
    width: 115mm !important;
  }

  body:not(.certificate-print-page) .report-form-table .report-form-qr-col {
    width: 14mm !important;
  }

  body:not(.certificate-print-page) .report-form-table .report-form-code {
    width: 46mm !important;
  }

  body:not(.certificate-print-page) .report-form-table .report-form-individual-name {
    width: 161mm !important;
  }

  body:not(.certificate-print-page) .report-form-table .report-form-individual-qr {
    width: 60mm !important;
  }
}

@media print {
  body:not(.certificate-print-page) .athlete-list-print-sheet table {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
    border-spacing: 0 !important;
  }

  body:not(.certificate-print-page) .athlete-list-print-sheet thead {
    display: table-header-group !important;
  }

  body:not(.certificate-print-page) .athlete-list-print-sheet tbody {
    display: table-row-group !important;
  }

  body:not(.certificate-print-page) .athlete-list-print-sheet tr {
    display: table-row !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    background: transparent !important;
  }

  body:not(.certificate-print-page) .athlete-list-print-sheet th,
  body:not(.certificate-print-page) .athlete-list-print-sheet td {
    display: table-cell !important;
    width: auto !important;
    margin: 0 !important;
    border: 1px solid #111 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    padding: 1.4mm 1.8mm !important;
    text-align: left !important;
    vertical-align: middle !important;
  }

  body:not(.certificate-print-page) .athlete-list-print-sheet img,
  body:not(.certificate-print-page) .athlete-list-print-sheet svg {
    width: 9mm !important;
    height: 9mm !important;
  }
}
/* End-of-file mobile override: keep phone screens usable after all print rules. */
@media screen and (max-width: 767.98px) {
  .table-responsive,
  .table-responsive-mobile {
    overflow-x: visible !important;
  }

  .table-responsive:has(.mobile-scroll-table),
  .table-responsive-mobile:has(.mobile-scroll-table) {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  table.mobile-card-table,
  .table-responsive table.mobile-card-table,
  .table-responsive-mobile table.mobile-card-table {
    display: block !important;
    min-width: 0 !important;
    width: 100% !important;
    border: 0 !important;
  }

  table.mobile-card-table thead {
    display: none !important;
  }

  table.mobile-card-table tbody {
    display: grid !important;
    gap: .65rem !important;
    width: 100% !important;
  }

  table.mobile-card-table tr {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: .55rem .65rem !important;
    border: 1px solid var(--py-line) !important;
    border-radius: 8px !important;
    background: #fff !important;
    box-shadow: 0 4px 12px rgba(24, 37, 43, .04) !important;
  }

  table.mobile-card-table td,
  table.mobile-card-table th {
    display: grid !important;
    grid-template-columns: minmax(92px, 38%) minmax(0, 1fr) !important;
    gap: .65rem !important;
    width: 100% !important;
    padding: .38rem 0 !important;
    border: 0 !important;
    border-bottom: 1px solid #eef3f1 !important;
    text-align: right !important;
    vertical-align: top !important;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  table.mobile-card-table td:last-child,
  table.mobile-card-table th:last-child {
    border-bottom: 0 !important;
  }

  table.mobile-card-table td::before,
  table.mobile-card-table th::before {
    content: attr(data-label) !important;
    color: var(--py-muted);
    font-weight: 800;
    text-align: left;
  }

  table.mobile-card-table td:not([data-label])::before,
  table.mobile-card-table th:not([data-label])::before,
  table.mobile-card-table td[data-label=""]::before,
  table.mobile-card-table th[data-label=""]::before {
    content: "" !important;
  }

  table.mobile-card-table td[colspan],
  table.mobile-card-table th[colspan] {
    display: block !important;
    text-align: center !important;
  }

  table.mobile-scroll-table,
  .table-responsive table.mobile-scroll-table,
  .table-responsive-mobile table.mobile-scroll-table {
    display: table !important;
    min-width: 680px !important;
    width: 100% !important;
    table-layout: auto !important;
  }

  table.mobile-scroll-table thead {
    display: table-header-group !important;
  }

  table.mobile-scroll-table tbody {
    display: table-row-group !important;
  }

  table.mobile-scroll-table tr {
    display: table-row !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  table.mobile-scroll-table th,
  table.mobile-scroll-table td {
    display: table-cell !important;
    width: auto !important;
    padding: .45rem .55rem !important;
    text-align: inherit;
  }

  table.mobile-scroll-table th::before,
  table.mobile-scroll-table td::before {
    content: none !important;
  }
}

@media screen and (max-width: 420px) {
  table.mobile-card-table td,
  table.mobile-card-table th {
    grid-template-columns: 1fr !important;
    text-align: left !important;
    gap: .15rem !important;
  }
}

@media screen and (max-width: 767.98px) {
  .table-responsive.has-mobile-scroll-table,
  .table-responsive-mobile.has-mobile-scroll-table {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

.field-result-sheet {
  width: 100%;
  max-width: 297mm;
  margin: 0 auto 12px;
  padding: 8mm;
  background: #fff;
  color: #111;
  border: 1px solid #111;
  page-break-inside: avoid;
  break-inside: avoid;
}

.field-result-head {
  display: flex;
  justify-content: space-between;
  gap: 10mm;
  margin-bottom: 5mm;
  font-size: 10pt;
}

.field-result-head h2 {
  margin: 0 0 2mm;
  font-size: 14pt;
}

.field-result-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 9.5pt;
}

.field-result-table th,
.field-result-table td {
  border: 1px solid #111;
  padding: 1.5mm 2mm;
  height: 8mm;
  vertical-align: middle;
}

.field-result-table th {
  text-align: center;
  font-weight: 700;
}

.field-sheet-photo {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border: 1px solid #111;
  border-radius: 2px;
}

.field-result-signatures {
  display: flex;
  justify-content: space-between;
  gap: 10mm;
  margin-top: 8mm;
  font-size: 10pt;
}

.field-result-signatures span {
  display: inline-block;
  width: 55mm;
  border-bottom: 1px dotted #111;
}

.announcer-sheet {
  width: 100%;
  max-width: 210mm;
  margin: 0 auto 12px;
  padding: 10mm;
  background: #fff;
  color: #111;
  border: 1px solid #111;
}

.announcer-head {
  display: flex;
  justify-content: space-between;
  gap: 10mm;
  margin-bottom: 6mm;
  font-size: 11pt;
}

.announcer-head h2 {
  margin: 0 0 2mm;
  font-size: 18pt;
}

.announcer-event {
  font-size: 14pt;
  font-weight: 700;
}

.announcer-group {
  margin-top: 6mm;
  break-inside: avoid;
  page-break-inside: avoid;
}

.announcer-group h3 {
  margin: 0 0 2mm;
  padding: 1.5mm 2mm;
  background: #f1f5f9;
  border: 1px solid #111;
  font-size: 13pt;
}

.announcer-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12pt;
}

.announcer-table th,
.announcer-table td {
  border: 1px solid #111;
  padding: 2mm 2.4mm;
  vertical-align: top;
}

.announcer-table th {
  text-align: center;
  font-weight: 700;
}

.announcer-results-sheet .announcer-table td {
  font-size: 12.5pt;
}

.announcer-results-table td:first-child,
.announcer-results-table td:last-child {
  font-size: 14pt;
}

@media screen and (max-width: 767.98px) {
  .field-result-sheet {
    overflow-x: auto;
  }

  .field-result-table {
    min-width: 900px;
  }
}

@media print {
  body:not(.certificate-print-page) .field-result-sheet {
    page: report-call-landscape;
    width: 281mm !important;
    max-width: 281mm !important;
    margin: 0 0 4mm !important;
    padding: 5mm !important;
    border: 0 !important;
    box-shadow: none !important;
    page-break-after: always;
    break-after: page;
  }

  body:not(.certificate-print-page) .field-result-head {
    font-size: 9pt !important;
    margin-bottom: 3mm !important;
  }

  body:not(.certificate-print-page) .field-result-head h2 {
    font-size: 12pt !important;
  }

  body:not(.certificate-print-page) .field-result-table {
    display: table !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    font-size: 8.5pt !important;
  }

  body:not(.certificate-print-page) .field-result-table thead {
    display: table-header-group !important;
  }

  body:not(.certificate-print-page) .field-result-table tbody {
    display: table-row-group !important;
  }

  body:not(.certificate-print-page) .field-result-table tr {
    display: table-row !important;
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  body:not(.certificate-print-page) .field-result-table th,
  body:not(.certificate-print-page) .field-result-table td {
    display: table-cell !important;
    padding: 1mm 1.4mm !important;
    height: 7mm !important;
    border: 1px solid #111 !important;
  }

  body:not(.certificate-print-page) .field-sheet-photo {
    width: 8.5mm !important;
    height: 8.5mm !important;
    object-fit: cover !important;
    border: .25mm solid #111 !important;
    border-radius: .8mm !important;
  }

  body:not(.certificate-print-page) .field-result-table th::before,
  body:not(.certificate-print-page) .field-result-table td::before {
    content: none !important;
  }

  body:not(.certificate-print-page) .announcer-sheet {
    page: report-call-portrait;
    width: 190mm !important;
    max-width: 190mm !important;
    margin: 0 auto 5mm !important;
    padding: 6mm !important;
    border: 0 !important;
    box-shadow: none !important;
    break-after: page;
    page-break-after: always;
  }

  body:not(.certificate-print-page) .announcer-sheet:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  body:not(.certificate-print-page) .announcer-head {
    font-size: 10pt !important;
    margin-bottom: 4mm !important;
  }

  body:not(.certificate-print-page) .announcer-head h2 {
    font-size: 16pt !important;
  }

  body:not(.certificate-print-page) .announcer-event {
    font-size: 13pt !important;
  }

  body:not(.certificate-print-page) .announcer-group {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    margin-top: 4mm !important;
  }

  body:not(.certificate-print-page) .announcer-group h3 {
    font-size: 12pt !important;
    padding: 1mm 1.5mm !important;
  }

  body:not(.certificate-print-page) .announcer-table {
    display: table !important;
    table-layout: fixed !important;
    font-size: 10.5pt !important;
  }

  body:not(.certificate-print-page) .announcer-table thead {
    display: table-header-group !important;
  }

  body:not(.certificate-print-page) .announcer-table tbody {
    display: table-row-group !important;
  }

  body:not(.certificate-print-page) .announcer-table tr {
    display: table-row !important;
  }

  body:not(.certificate-print-page) .announcer-table th,
  body:not(.certificate-print-page) .announcer-table td {
    display: table-cell !important;
    padding: 1.5mm 2mm !important;
    border: 1px solid #111 !important;
  }

  body:not(.certificate-print-page) .announcer-table th::before,
  body:not(.certificate-print-page) .announcer-table td::before {
    content: none !important;
  }

  body:not(.certificate-print-page) .announcer-results-sheet .announcer-table td {
    font-size: 11pt !important;
  }

  body:not(.certificate-print-page) .announcer-results-table td:first-child,
  body:not(.certificate-print-page) .announcer-results-table td:last-child {
    font-size: 12pt !important;
  }
}

@media screen {
  .report-form-sheet + .report-form-sheet {
    position: relative;
    margin-top: 34px;
  }

  .report-form-sheet + .report-form-sheet::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -18px;
    border-top: 1px dashed #94a3b8;
  }
}

@media print {
  .report-form-sheet + .report-form-sheet::before {
    content: none !important;
  }
}

@media print {
  body:not(.certificate-print-page) .athlete-photo-panel {
    width: 190mm !important;
    max-width: 190mm !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body:not(.certificate-print-page) .athlete-photo-panel:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }

  body:not(.certificate-print-page) .photo-panel-table {
    display: table !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
    border-spacing: 0 !important;
    font-size: 7.8pt !important;
  }

  body:not(.certificate-print-page) .photo-panel-table thead {
    display: table-header-group !important;
  }

  body:not(.certificate-print-page) .photo-panel-table tbody {
    display: table-row-group !important;
  }

  body:not(.certificate-print-page) .photo-panel-table tr {
    display: table-row !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    height: 31mm !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body:not(.certificate-print-page) .photo-panel-table th,
  body:not(.certificate-print-page) .photo-panel-table td {
    display: table-cell !important;
    width: auto !important;
    margin: 0 !important;
    border: 1px solid #111 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: .9mm 1.1mm !important;
    text-align: left !important;
    vertical-align: top !important;
    overflow: hidden !important;
  }

  body:not(.certificate-print-page) .photo-panel-table th {
    text-align: center !important;
  }

  body:not(.certificate-print-page) .photo-panel-table th::before,
  body:not(.certificate-print-page) .photo-panel-table td::before {
    content: none !important;
  }

  body:not(.certificate-print-page) .panel-photo {
    width: 13mm !important;
    height: 16mm !important;
    margin-bottom: .6mm !important;
  }

  body:not(.certificate-print-page) .photo-panel-header {
    margin-bottom: 2mm !important;
    line-height: 1.12 !important;
    font-size: 8pt !important;
  }

  body:not(.certificate-print-page) .photo-panel-header h2 {
    font-size: 10.5pt !important;
    margin-bottom: .5mm !important;
  }

  body:not(.certificate-print-page) .panel-name {
    min-height: 2.8mm !important;
    margin-top: .4mm !important;
    font-size: 6.8pt !important;
  }

  body:not(.certificate-print-page) .panel-code {
    margin-top: .4mm !important;
    font-size: 6.8pt !important;
    letter-spacing: 1px !important;
  }

  body:not(.certificate-print-page) .panel-events div {
    min-height: 3.8mm !important;
    font-size: 6.8pt !important;
  }

  body:not(.certificate-print-page) .signature-line {
    height: 16mm !important;
    margin-top: 5mm !important;
  }

  body:not(.certificate-print-page) .signature-stack {
    gap: 2.2mm !important;
    margin-top: 3mm !important;
  }

  body:not(.certificate-print-page) .signature-stack span {
    height: 3mm !important;
  }

  body:not(.certificate-print-page) .photo-panel-table th:first-child,
  body:not(.certificate-print-page) .photo-panel-table td:first-child {
    width: 5mm !important;
    min-width: 5mm !important;
    max-width: 5mm !important;
    padding-left: .4mm !important;
    padding-right: .4mm !important;
    text-align: center !important;
  }

  body:not(.certificate-print-page) .photo-panel-table th:nth-child(2),
  body:not(.certificate-print-page) .photo-panel-table td:nth-child(2) {
    width: 38mm !important;
  }
}

/* Printed pages are documents, not responsive mobile cards. Keep this after mobile rules. */
@media print {
  body:not(.certificate-print-page) {
    min-width: 1024px !important;
    background: #fff !important;
  }

  body:not(.certificate-print-page) .app-main,
  body:not(.certificate-print-page) .app-shell,
  body:not(.certificate-print-page) .container,
  body:not(.certificate-print-page) .container-fluid {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body:not(.certificate-print-page) .row {
    display: flex !important;
    flex-wrap: wrap !important;
  }

  body:not(.certificate-print-page) [class*="col-sm-"],
  body:not(.certificate-print-page) [class*="col-md-"],
  body:not(.certificate-print-page) [class*="col-lg-"],
  body:not(.certificate-print-page) [class*="col-xl-"],
  body:not(.certificate-print-page) [class*="col-xxl-"] {
    flex: 0 0 auto !important;
  }

  body:not(.certificate-print-page) .col-sm-1, body:not(.certificate-print-page) .col-md-1, body:not(.certificate-print-page) .col-lg-1, body:not(.certificate-print-page) .col-xl-1, body:not(.certificate-print-page) .col-xxl-1 { width: 8.33333333% !important; }
  body:not(.certificate-print-page) .col-sm-2, body:not(.certificate-print-page) .col-md-2, body:not(.certificate-print-page) .col-lg-2, body:not(.certificate-print-page) .col-xl-2, body:not(.certificate-print-page) .col-xxl-2 { width: 16.66666667% !important; }
  body:not(.certificate-print-page) .col-sm-3, body:not(.certificate-print-page) .col-md-3, body:not(.certificate-print-page) .col-lg-3, body:not(.certificate-print-page) .col-xl-3, body:not(.certificate-print-page) .col-xxl-3 { width: 25% !important; }
  body:not(.certificate-print-page) .col-sm-4, body:not(.certificate-print-page) .col-md-4, body:not(.certificate-print-page) .col-lg-4, body:not(.certificate-print-page) .col-xl-4, body:not(.certificate-print-page) .col-xxl-4 { width: 33.33333333% !important; }
  body:not(.certificate-print-page) .col-sm-5, body:not(.certificate-print-page) .col-md-5, body:not(.certificate-print-page) .col-lg-5, body:not(.certificate-print-page) .col-xl-5, body:not(.certificate-print-page) .col-xxl-5 { width: 41.66666667% !important; }
  body:not(.certificate-print-page) .col-sm-6, body:not(.certificate-print-page) .col-md-6, body:not(.certificate-print-page) .col-lg-6, body:not(.certificate-print-page) .col-xl-6, body:not(.certificate-print-page) .col-xxl-6 { width: 50% !important; }
  body:not(.certificate-print-page) .col-sm-7, body:not(.certificate-print-page) .col-md-7, body:not(.certificate-print-page) .col-lg-7, body:not(.certificate-print-page) .col-xl-7, body:not(.certificate-print-page) .col-xxl-7 { width: 58.33333333% !important; }
  body:not(.certificate-print-page) .col-sm-8, body:not(.certificate-print-page) .col-md-8, body:not(.certificate-print-page) .col-lg-8, body:not(.certificate-print-page) .col-xl-8, body:not(.certificate-print-page) .col-xxl-8 { width: 66.66666667% !important; }
  body:not(.certificate-print-page) .col-sm-9, body:not(.certificate-print-page) .col-md-9, body:not(.certificate-print-page) .col-lg-9, body:not(.certificate-print-page) .col-xl-9, body:not(.certificate-print-page) .col-xxl-9 { width: 75% !important; }
  body:not(.certificate-print-page) .col-sm-10, body:not(.certificate-print-page) .col-md-10, body:not(.certificate-print-page) .col-lg-10, body:not(.certificate-print-page) .col-xl-10, body:not(.certificate-print-page) .col-xxl-10 { width: 83.33333333% !important; }
  body:not(.certificate-print-page) .col-sm-11, body:not(.certificate-print-page) .col-md-11, body:not(.certificate-print-page) .col-lg-11, body:not(.certificate-print-page) .col-xl-11, body:not(.certificate-print-page) .col-xxl-11 { width: 91.66666667% !important; }
  body:not(.certificate-print-page) .col-sm-12, body:not(.certificate-print-page) .col-md-12, body:not(.certificate-print-page) .col-lg-12, body:not(.certificate-print-page) .col-xl-12, body:not(.certificate-print-page) .col-xxl-12 { width: 100% !important; }

  body:not(.certificate-print-page) .card,
  body:not(.certificate-print-page) .app-card,
  body:not(.certificate-print-page) .surface-card,
  body:not(.certificate-print-page) .card-body,
  body:not(.certificate-print-page) .card-header,
  body:not(.certificate-print-page) .card-footer {
    display: block !important;
  }

  body:not(.certificate-print-page) .table-responsive,
  body:not(.certificate-print-page) .table-responsive-mobile {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    overflow: visible !important;
  }

  body:not(.certificate-print-page) table,
  body:not(.certificate-print-page) .table,
  body:not(.certificate-print-page) table.mobile-card-table,
  body:not(.certificate-print-page) .table-responsive table,
  body:not(.certificate-print-page) .table-responsive-mobile table {
    display: table !important;
    width: 100% !important;
    border-collapse: collapse !important;
  }

  body:not(.certificate-print-page) thead,
  body:not(.certificate-print-page) table.mobile-card-table thead {
    display: table-header-group !important;
  }

  body:not(.certificate-print-page) tbody,
  body:not(.certificate-print-page) table.mobile-card-table tbody {
    display: table-row-group !important;
  }

  body:not(.certificate-print-page) tfoot,
  body:not(.certificate-print-page) table.mobile-card-table tfoot {
    display: table-footer-group !important;
  }

  body:not(.certificate-print-page) tr,
  body:not(.certificate-print-page) table.mobile-card-table tr {
    display: table-row !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body:not(.certificate-print-page) th,
  body:not(.certificate-print-page) td,
  body:not(.certificate-print-page) table.mobile-card-table th,
  body:not(.certificate-print-page) table.mobile-card-table td {
    display: table-cell !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    vertical-align: top !important;
  }

  body:not(.certificate-print-page) th::before,
  body:not(.certificate-print-page) td::before,
  body:not(.certificate-print-page) table.mobile-card-table th::before,
  body:not(.certificate-print-page) table.mobile-card-table td::before {
    content: none !important;
    display: none !important;
  }
}

/* Final report-call print override: keep report-call sheets as desktop tables. */
@media print {
  @page report-call-landscape {
    size: A4 landscape;
    margin: 8mm;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet {
    page: report-call-landscape !important;
    display: block !important;
    width: 281mm !important;
    max-width: 281mm !important;
    min-width: 281mm !important;
    margin: 0 auto 4mm !important;
    padding: 0 !important;
    background: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
    break-after: page !important;
    page-break-after: always !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet:last-child {
    break-after: auto !important;
    page-break-after: auto !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .card-body {
    display: block !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .d-flex {
    display: flex !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet table,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .table {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet thead {
    display: table-header-group !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet tbody {
    display: table-row-group !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet tr {
    display: table-row !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet th,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet td {
    display: table-cell !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 2mm !important;
    border: 1px solid #111 !important;
    vertical-align: middle !important;
    white-space: normal !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet th::before,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet td::before {
    content: none !important;
    display: none !important;
  }
}

/* Admin and staff final override: navy operations theme */
body.theme-staff,
body.theme-admin {
  --py-primary: #12395d !important;
  --py-primary-2: #0f2742 !important;
  --py-accent: #d9a441 !important;
  --py-accent-2: #f2c96b !important;
  --py-mint: #2f80a8 !important;
  --py-soft: #eef4f9 !important;
  --py-line: #c8d7e6 !important;
  --py-text: #102033 !important;
  --py-muted: #607287 !important;
  --py-bg: #f4f7fa !important;
  --py-bg-2: #eef3f8 !important;
  --py-sidebar-start: #0f2742 !important;
  --py-sidebar-end: #12395d !important;
  --py-hero-start: #0f2742 !important;
  --py-hero-end: #12395d !important;
}

body.theme-staff,
body.theme-admin {
  background: #f4f7fa !important;
}

.theme-staff .app-sidebar,
.theme-admin .app-sidebar,
.theme-staff .public-hero,
.theme-admin .public-hero,
.theme-staff .hero-stat,
.theme-admin .hero-stat {
  background: #0f2742 !important;
  background-image: none !important;
}

.theme-staff .app-topbar,
.theme-admin .app-topbar {
  border-bottom-color: #c8d7e6 !important;
  background: #ffffff !important;
}

.theme-staff .sidebar-context span,
.theme-admin .sidebar-context span {
  color: #f2c96b !important;
}

.theme-staff .sidebar-nav a.active .nav-dot,
.theme-admin .sidebar-nav a.active .nav-dot {
  background: #f2c96b !important;
}

.theme-staff .btn-primary,
.theme-admin .btn-primary,
.theme-staff .btn-success,
.theme-admin .btn-success,
.theme-staff .btn-info,
.theme-admin .btn-info {
  background: #12395d !important;
  border-color: #12395d !important;
}

.theme-staff .btn-primary:hover,
.theme-admin .btn-primary:hover,
.theme-staff .btn-success:hover,
.theme-admin .btn-success:hover,
.theme-staff .btn-info:hover,
.theme-admin .btn-info:hover {
  background: #0f2742 !important;
  border-color: #0f2742 !important;
}

.theme-staff .btn-outline-primary,
.theme-admin .btn-outline-primary,
.theme-staff .btn-outline-success,
.theme-admin .btn-outline-success,
.theme-staff .btn-outline-info,
.theme-admin .btn-outline-info {
  color: #12395d !important;
  border-color: #12395d !important;
}

.theme-staff .btn-outline-primary:hover,
.theme-admin .btn-outline-primary:hover,
.theme-staff .btn-outline-success:hover,
.theme-admin .btn-outline-success:hover,
.theme-staff .btn-outline-info:hover,
.theme-admin .btn-outline-info:hover {
  color: #ffffff !important;
  background: #12395d !important;
  border-color: #12395d !important;
}

.theme-staff .brand-mark,
.theme-admin .brand-mark,
.theme-staff .btn-accent,
.theme-admin .btn-accent {
  background: #d9a441 !important;
  border-color: #d9a441 !important;
  color: #102033 !important;
}

/* Final override: report-call slips print on A4 portrait with cut guides. */
@media print {
  @page report-call-portrait {
    size: A4 portrait;
    margin: 10mm;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet {
    page: report-call-portrait !important;
    width: 190mm !important;
    min-width: 190mm !important;
    max-width: 190mm !important;
    margin: 0 auto 5mm !important;
    padding: 0 0 5mm !important;
    border: 0 !important;
    border-bottom: 1px dashed #111 !important;
    box-shadow: none !important;
    break-after: auto !important;
    page-break-after: auto !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet:last-child {
    border-bottom: 0 !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .card-body {
    padding: 0 !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet h2 {
    font-size: 13pt !important;
    margin-bottom: 1mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet div,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .small,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .text-muted {
    font-size: 8.5pt !important;
    line-height: 1.25 !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet table,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    font-size: 8.5pt !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet th,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet td {
    padding: 1mm 1.2mm !important;
    line-height: 1.2 !important;
    vertical-align: top !important;
    border: 1px solid #111 !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .report-call-print-table th:first-child,
  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .report-call-print-table td:first-child {
    width: 11mm !important;
    min-width: 11mm !important;
    max-width: 11mm !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet img:not([alt="QR"]) {
    width: 18px !important;
    height: 18px !important;
    object-fit: cover !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .mt-4 {
    margin-top: 3mm !important;
  }
}

/* Absolute final override: report-call slips must fit A4 landscape. */
@media print {
  @page report-call-landscape-final {
    size: A4 landscape;
    margin: 10mm;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet {
    page: report-call-landscape-final !important;
    width: 277mm !important;
    min-width: 277mm !important;
    max-width: 277mm !important;
    margin: 0 auto 5mm !important;
    padding: 0 0 5mm !important;
    border: 0 !important;
    border-bottom: 1px dashed #111 !important;
    box-shadow: none !important;
    break-after: auto !important;
    page-break-after: auto !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet:last-child {
    border-bottom: 0 !important;
  }

  body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .report-call-print-table th:first-child,
body:not(.certificate-print-page) .report-call-sheet.print-table-sheet .report-call-print-table td:first-child {
    width: 14mm !important;
    min-width: 14mm !important;
    max-width: 14mm !important;
  }
}

.report-call-central-sheet {
  max-width: 210mm;
  margin: 0 auto 18px;
  padding: 14mm;
  background: #fff;
  border: 1px solid #111;
  color: #111;
}

.central-report-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12mm;
  margin-bottom: 6mm;
}

.central-report-head h2 {
  margin: 0 0 1mm;
  font-size: 20px;
  font-weight: 700;
}

.central-report-subtitle {
  font-size: 14px;
}

.central-report-qr {
  width: 28mm;
  min-height: 28mm;
  text-align: center;
}

.central-report-qr img {
  width: 28mm;
  height: 28mm;
}

.central-report-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5mm 6mm;
  margin-bottom: 5mm;
  font-size: 14px;
}

.central-report-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}

.central-report-table th,
.central-report-table td {
  border: 1px solid #111;
  padding: 2.2mm 2.4mm;
  vertical-align: middle;
}

.central-report-table th {
  text-align: center;
  font-weight: 700;
}

.central-report-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6mm;
  margin-top: 5mm;
  font-size: 14px;
}

.central-report-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12mm;
  margin-top: 12mm;
  font-size: 14px;
}

.central-report-signatures span {
  display: inline-block;
  width: 44mm;
  border-bottom: 1px dotted #111;
}

@media print {
  @page central-report-portrait {
    size: A4 portrait;
    margin: 10mm;
  }

  body:not(.certificate-print-page) .report-call-central-sheet.print-table-sheet {
    page: central-report-portrait !important;
    width: 190mm !important;
    min-width: 190mm !important;
    max-width: 190mm !important;
    margin: 0 auto !important;
    padding: 8mm !important;
    border: 0 !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
    break-after: page !important;
    page-break-after: always !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body:not(.certificate-print-page) .report-call-central-sheet.print-table-sheet:last-child {
    break-after: auto !important;
    page-break-after: auto !important;
  }

  body:not(.certificate-print-page) .report-call-central-sheet .central-report-head {
    margin-bottom: 5mm !important;
  }

  body:not(.certificate-print-page) .report-call-central-sheet .central-report-head h2 {
    font-size: 15pt !important;
    margin: 0 0 1mm !important;
  }

  body:not(.certificate-print-page) .report-call-central-sheet .central-report-meta {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1mm 5mm !important;
    margin-bottom: 4mm !important;
  }

  body:not(.certificate-print-page) .report-call-central-sheet .central-report-table th,
  body:not(.certificate-print-page) .report-call-central-sheet .central-report-table td {
    padding: 1.8mm 2mm !important;
    line-height: 1.28 !important;
    vertical-align: middle !important;
  }

  body:not(.certificate-print-page) .report-call-central-sheet.print-table-sheet div,
  body:not(.certificate-print-page) .report-call-central-sheet.print-table-sheet .central-report-table,
  body:not(.certificate-print-page) .report-call-central-sheet.print-table-sheet .central-report-table th,
  body:not(.certificate-print-page) .report-call-central-sheet.print-table-sheet .central-report-table td {
    font-size: 10pt !important;
  }

  body:not(.certificate-print-page) .report-call-central-sheet .central-report-qr img {
    width: 24mm !important;
    height: 24mm !important;
  }

  body:not(.certificate-print-page) .report-call-central-sheet .central-report-checks,
  body:not(.certificate-print-page) .report-call-central-sheet .central-report-signatures {
    font-size: 10pt !important;
  }
}

/* Absolute final override: athlete ID cards print 9 per A4 portrait page. */
@media print {
  @page athlete-id-card-portrait {
    size: A4 portrait;
    margin: 8mm;
  }

  body:not(.certificate-print-page):has(.athlete-id-card-grid) {
    page: athlete-id-card-portrait !important;
    min-width: 0 !important;
  }

  body:not(.certificate-print-page) .athlete-id-card-grid {
    page: athlete-id-card-portrait !important;
    display: grid !important;
    width: 184mm !important;
    max-width: 184mm !important;
    grid-template-columns: repeat(3, 59mm) !important;
    grid-auto-rows: 90mm !important;
    gap: 3mm 4.5mm !important;
    align-items: start !important;
    justify-content: center !important;
    margin: 0 auto !important;
  }

  body:not(.certificate-print-page) .athlete-id-card-form {
    width: 59mm !important;
    height: 90mm !important;
    margin: 0 !important;
    transform: none !important;
    transform-origin: top left !important;
  }

  body:not(.certificate-print-page) .athlete-code-boxes {
    left: 3mm !important;
    right: 20mm !important;
    transform: none !important;
    justify-content: center !important;
  }

  body:not(.certificate-print-page) .athlete-id-card-form .athlete-card-photo {
    width: 18mm !important;
    height: 23mm !important;
    overflow: hidden !important;
  }

  body:not(.certificate-print-page) .athlete-id-card-form .athlete-card-photo img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    object-position: center center !important;
  }
}

/* Absolute final override: athlete photo panels must fit A4 portrait. */
@media print {
  @page athlete-photo-panel-page {
    size: A4 portrait;
    margin: 8mm;
  }

  body:not(.certificate-print-page):has(.athlete-photo-panel) {
    page: athlete-photo-panel-page !important;
    min-width: 0 !important;
    width: 194mm !important;
    max-width: 194mm !important;
    margin: 0 auto !important;
    background: #fff !important;
  }

  body:not(.certificate-print-page) .athlete-photo-panel {
    page: athlete-photo-panel-page !important;
    width: 194mm !important;
    max-width: 194mm !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: hidden !important;
    break-after: page !important;
    page-break-after: always !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  body:not(.certificate-print-page):has(.athlete-photo-panel) .app-main,
  body:not(.certificate-print-page):has(.athlete-photo-panel) .app-shell,
  body:not(.certificate-print-page):has(.athlete-photo-panel) .container,
  body:not(.certificate-print-page):has(.athlete-photo-panel) .container-fluid {
    width: 194mm !important;
    max-width: 194mm !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body:not(.certificate-print-page) .athlete-photo-panel:last-child {
    break-after: auto !important;
    page-break-after: auto !important;
  }

  body:not(.certificate-print-page) .photo-panel-header {
    margin-bottom: 4mm !important;
    line-height: 1.22 !important;
    font-size: 10pt !important;
  }

  body:not(.certificate-print-page) .photo-panel-header h2 {
    font-size: 15pt !important;
    margin: 0 0 1mm !important;
  }

  body:not(.certificate-print-page) .photo-panel-header .mt-2 {
    margin-top: 1.6mm !important;
  }

  body:not(.certificate-print-page) .photo-panel-table {
    width: 194mm !important;
    max-width: 194mm !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    font-size: 9.2pt !important;
    line-height: 1.22 !important;
  }

  body:not(.certificate-print-page) .photo-panel-table th,
  body:not(.certificate-print-page) .photo-panel-table td {
    padding: 1.6mm 2mm !important;
    border: 1px solid #111 !important;
    vertical-align: top !important;
    overflow: hidden !important;
  }

  body:not(.certificate-print-page) .photo-panel-table tbody tr {
    height: 54mm !important;
  }

  body:not(.certificate-print-page) .panel-photo {
    width: 24mm !important;
    height: 30mm !important;
    margin: 0 auto 1.4mm !important;
  }

  body:not(.certificate-print-page) .panel-name,
  body:not(.certificate-print-page) .panel-code,
  body:not(.certificate-print-page) .panel-events div {
    font-size: 8.8pt !important;
    line-height: 1.2 !important;
  }

  body:not(.certificate-print-page) .panel-name {
    min-height: 4mm !important;
    margin-top: .5mm !important;
  }

  body:not(.certificate-print-page) .panel-code {
    margin-top: .6mm !important;
    letter-spacing: 0 !important;
  }

  body:not(.certificate-print-page) .panel-events div {
    min-height: 7.5mm !important;
  }

  body:not(.certificate-print-page) .photo-panel-table th:first-child,
  body:not(.certificate-print-page) .photo-panel-table td:first-child {
    width: 5mm !important;
    min-width: 5mm !important;
    max-width: 5mm !important;
    padding-left: .5mm !important;
    padding-right: .5mm !important;
    text-align: center !important;
  }

  body:not(.certificate-print-page) .photo-panel-table th:nth-child(2),
  body:not(.certificate-print-page) .photo-panel-table td:nth-child(2) {
    width: 56mm !important;
  }
}

