:root {
  color-scheme: light;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #f4f6f9;
  color: #1f2937;
  --ui-desktop-max-width: 1840px;
  --ui-desktop-content-pad-x: 1.25rem;
  --ui-desktop-content-pad-y: 1.1rem;
  --ui-desktop-page-gap: 1.35rem;
}

@media print {
  @page { size: A3 landscape; margin: 8mm; }

  html, body {
    width: auto !important;
    height: auto !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  header,
  nav,
  footer,
  .sidebar,
  .top-nav,
  .top-tabs,
  .section-header,
  .export-icons,
  .handover-history,
  .h2h-history-sidebar,
  .topbar {
    display: none !important;
  }

  body { visibility: visible !important; }

  .page-container,
  .h2h-page {
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .h2h-page { display: block !important; }

  .h2h-editor-layout {
    display: block !important;
    width: auto !important;
    max-width: none !important;
  }

  .h2h-editor-layout.handover-layout--edge .handover-main {
    padding-right: 0 !important;
  }

  #h2h-print-root,
  #h2hPrintRoot {
    margin: 0;
    padding: 0;
  }

  .h2h-print-block {
    width: max-content !important;
    width: fit-content !important;
    margin: 0 auto !important;
    transform-origin: top center !important;
    transform: scale(var(--h2h-print-scale, 1)) !important;
    display: block;
  }

  .h2h-frame,
  .h2h-scoreboard {
    width: 100% !important;
    max-width: none !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  .h2h-page,
  .h2h-frame {
    overflow: visible !important;
  }

  .h2h-table-wrap {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .h2h-table,
  .h2h-table * {
    overflow: visible !important;
    max-height: none !important;
  }

  .h2h-table thead { display: table-row-group !important; }
  .h2h-table tfoot { display: table-footer-group; }
  .h2h-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .h2h-summary {
    margin-top: 0 !important;
    overflow: visible !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .h2h-summary__grid,
  .h2h-scoreboard__stack {
    max-width: none !important;
  }

  .h2h-summary__grid--aligned {
    column-gap: 0;
  }

  .h2h-summary__row {
    line-height: 1.2;
  }

  .h2h-summary__col--bet .h2h-summary__rows,
  .h2h-summary__col--results .h2h-summary__rows,
  .h2h-summary__col--calc .h2h-summary__calc-grid {
    column-gap: 14px;
    row-gap: 4px;
  }

  .h2h-bet-meta__controls,
  button[data-patron-add],
  button[data-patron-remove] {
    display: none !important;
  }

  .h2h-scoreboard {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .h2h-scoreboard__header { flex-wrap: nowrap; }

  .h2h-print .h2h-table thead th,
  .sticky-col,
  .h2h-sticky,
  .sticky-right {
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
  }

  .h2h-print .app-footer {
    display: none !important;
  }
}
body {
  margin: 0;
  min-height: 100vh;
  font-family: inherit;
}

body.app {
  background-color: #f4f6f9;
}

input,
select,
textarea,
button {
  font-family: inherit;
}

body.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1f2937, #3b82f6);
}

.auth-layout {
  width: 100%;
  max-width: 360px;
  padding: 2.25rem 1.25rem;
}

.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-roster-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 6px;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.32);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  backdrop-filter: blur(10px);
}

.auth-roster-link__subtext {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.86;
  white-space: nowrap;
}

.auth-roster-link:hover,
.auth-roster-link:focus {
  color: #ffffff;
  background: rgba(15, 23, 42, 0.5);
  text-decoration: none;
}

.auth-card {
  background: #ffffff;
  padding: 1.75rem 1.5rem;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
  width: 100%;
  position: relative;
  min-height: 300px;
}

.auth-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.12);
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
}

.auth-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  color: #1f2937;
}

.auth-subtitle {
  text-align: center;
  color: #6b7280;
  margin: 0.5rem 0 2rem 0;
}

.auth-credential-hint {
 background: #f8fafc;
 border: 1px solid #e5e7eb;
 border-radius: 12px;
 padding: 0.75rem 1rem;
 margin: 0.5rem 0 0 0;
 font-size: 0.85rem;
 color: #334155;
}

.auth-credential-hint--outside {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #e0e7ff;
}

.auth-credential-hint--outside .auth-credential-hint__block {
  border-top-color: rgba(148, 163, 184, 0.4);
}


.auth-credential-hint__title {
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.auth-credential-hint__columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.auth-credential-hint__column-title {
  font-weight: 700;
  margin: 0.1rem 0 0.35rem 0;
}

.auth-credential-hint__block {
  padding-top: 0.5rem;
  margin-top: 0.5rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.6);
}

.auth-credential-hint__block:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0.25rem;
}

.auth-credential-hint__role {
  font-weight: 600;
  margin-bottom: 0.2rem;
}


.auth-credential-hint__row {
  display: flex;
  gap: 0.35rem;
}

@media (max-width: 900px) {
  .auth-credential-hint__columns {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

.auth-footer {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: #e0e7ff;
  width: 100%;
}

.auth-form .form-group {
  margin-bottom: 1.2rem;
}

.auth-timezone {
  position: absolute;
  right: 0.75rem;
  bottom: 0.65rem;
  font-size: 0.65rem;
  color: #94a3b8;
  text-align: right;
  line-height: 1.2;
}

.auth-timezone__title {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.15rem;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.sidebar {
  width: 190px;
  background-color: #1f2937;
  color: #f9fafb;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  position: sticky;
  top: var(--top-tabs-height, 0px);
  max-height: 100vh;
  overflow-y: auto;
}

.brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: inherit;
  text-decoration: none;
  margin-bottom: 2rem;
  display: inline-block;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  color: #e5e7eb;
  text-decoration: none;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
  background-color: rgba(59, 130, 246, 0.2);
  color: #ffffff;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 2rem;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

.top-tabs {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 2rem 0;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  overflow-x: auto;
  scrollbar-width: thin;
  position: sticky;
  top: 0;
  z-index: 20;
}

.top-tabs__left {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.top-tabs__right {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 0.35rem;
  white-space: nowrap;
}

.workspace-switch-form {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.workspace-switch-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #4b5563;
}

.workspace-switch-select {
  min-width: 132px;
  height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0 0.5rem;
  background: #ffffff;
  color: #1f2937;
  font-size: 0.82rem;
}

.top-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-bottom-color: transparent;
  border-radius: 0.75rem 0.75rem 0 0;
  text-decoration: none;
  color: #4b5563;
  font-weight: 600;
  white-space: nowrap;
  background: transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.top-tab__label--split {
  display: inline-block;
  font-size: 0.78rem;
  line-height: 1.05;
  text-align: center;
  white-space: normal;
}

.top-tab--stacked {
  flex-direction: column;
  gap: 0.12rem;
  line-height: 1.05;
}

.top-tab__subtext {
  font-size: 0.64rem;
  font-weight: 500;
  color: #64748b;
}

.top-tab:hover {
  color: #1f2937;
  background: #f8fafc;
}

.top-tab.active {
  color: #1f2937;
  background: #f1f5f9;
  border-color: #cbd5f5;
  border-bottom-color: #f1f5f9;
  box-shadow: inset 0 -2px 0 #2563eb;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.report-actions {
  gap: 0.6rem;
  margin-top: 0;
  margin-bottom: 0.35rem;
}

.report-actions .btn-primary,
.report-actions .btn-secondary,
.report-actions .btn-tertiary {
  align-self: flex-start;
}

.report-actions .btn-primary,
.report-actions .btn-secondary,
.report-actions .btn-tertiary {
  font-size: 0.78rem;
  padding: 0.5rem 0.8rem;
  line-height: 1;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 600;
  white-space: nowrap;
}

.header-title--primary {
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 1.35rem;
}

.actions--start {
  display: flex;
  justify-content: flex-start;
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #1f2937;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  cursor: pointer;
}

.theme-toggle__label {
  font-weight: 600;
}

.theme-toggle__track {
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: #e5e7eb;
  position: relative;
  transition: background 0.2s ease;
}

.theme-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #111827;
  transition: transform 0.2s ease;
}

.theme-toggle[aria-pressed="true"] .theme-toggle__track {
  background: #111827;
}

.theme-toggle[aria-pressed="true"] .theme-toggle__thumb {
  transform: translateX(16px);
  background: #f9fafb;
}

.user-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.85rem;
  color: #4b5563;
}

.user-id {
  font-weight: 600;
  color: #1f2937;
}

.user-role {
  font-size: 0.75rem;
  color: #6366f1;
}

.logout-form {
  margin: 0;
}

.app-content {
  padding: 2rem;
  flex: 1;
}

body.theme-dark {
  background: #0f172a;
  color: #e2e8f0;
}

body.theme-dark .sidebar {
  background: #0b1220;
  color: #e2e8f0;
  border-right: 1px solid #1f2937;
}

body.theme-dark .nav-item {
  color: #cbd5f5;
}

body.theme-dark .nav-item:hover,
body.theme-dark .nav-item.active {
  background-color: rgba(59, 130, 246, 0.2);
  color: #ffffff;
}

body.theme-dark .app-header {
  background: #0b1220;
  border-bottom-color: #1f2937;
}

body.theme-dark .top-tabs {
  background: #0b1220;
  border-bottom-color: #1f2937;
}

body.theme-dark .workspace-switch-label {
  color: #cbd5e1;
}

body.theme-dark .workspace-switch-select {
  background: #0b1220;
  border-color: #334155;
  color: #e2e8f0;
}

body.theme-dark .top-tab {
  color: #cbd5f5;
}

body.theme-dark .top-tab:hover {
  color: #f8fafc;
  background: #111827;
}

body.theme-dark .top-tab.active {
  color: #f8fafc;
  background: #111827;
  border-color: #334155;
  border-bottom-color: #111827;
  box-shadow: inset 0 -2px 0 #60a5fa;
}

body.theme-dark .app-main {
  background: #0f172a;
}

body.theme-dark .app-content {
  background: #0f172a;
}

body.theme-dark .app-footer {
  background: #0b1220;
  border-top: 1px solid #1f2937;
  color: #94a3b8;
}

body.theme-dark .card,
body.theme-dark .table-card,
body.theme-dark .data-table,
body.theme-dark .detail-section .card {
  background: #0b1220;
  color: #e2e8f0;
  border-color: #1f2937;
}

body.theme-dark .card-header,
body.theme-dark .card-header h3 {
  color: #e2e8f0;
}

body.theme-dark .user-id {
  color: #e2e8f0;
}

body.theme-dark .user-role {
  color: #93c5fd;
}

body.theme-dark .btn-tertiary {
  border-color: #334155;
  color: #e2e8f0;
  background: #0b1220;
}

body.theme-dark .btn-tertiary:hover {
  background: #111827;
  border-color: #475569;
}

body.theme-dark .theme-toggle {
  border-color: #334155;
  background: #0b1220;
  color: #e2e8f0;
}

body.theme-dark .theme-toggle__track {
  background: #334155;
}

body.theme-dark .btn-primary {
  background: #2563eb;
  border-color: #1d4ed8;
}

body.theme-dark .btn-secondary {
  background: #1f2937;
  border-color: #374151;
  color: #e2e8f0;
}

body.theme-dark .data-table {
  color: #e2e8f0;
}

body.theme-dark .data-table thead {
  background: #111827;
  color: #e2e8f0;
}

body.theme-dark .data-table th,
body.theme-dark .data-table td {
  border-color: #1f2937;
}

body.theme-dark .data-table tbody tr:hover {
  background: rgba(148, 163, 184, 0.1);
}

body.theme-dark .status-banner {
  background: #111827;
  border-color: #1f2937;
  color: #e2e8f0;
}

body.theme-dark .form-control,
body.theme-dark select,
body.theme-dark textarea {
  background: #0b1220;
  color: #e2e8f0;
  border-color: #1f2937;
}

body.theme-dark .form-control::placeholder,
body.theme-dark textarea::placeholder {
  color: #94a3b8;
}

body.theme-dark .form-control:focus,
body.theme-dark select:focus,
body.theme-dark textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

body.theme-dark .report-body--plain,
body.theme-dark .report-body,
body.theme-dark .report-body--plain p {
  color: #e2e8f0;
}

body.theme-dark .person-card,
body.theme-dark .person-card__details,
body.theme-dark .person-card__detail {
  background: #0b1220;
  color: #e2e8f0;
  border-color: #1f2937;
}

body.theme-dark .person-card__chip {
  background: #111827;
  color: #e2e8f0;
}

body.theme-dark .linked-report-card,
body.theme-dark .attachment-card {
  background: #0b1220;
  border-color: #1f2937;
  color: #e2e8f0;
}

body.theme-dark .linked-report-card__title {
  color: #93c5fd;
}

body.theme-dark .linked-report-card__title:hover,
body.theme-dark .linked-report-card__title:focus-visible {
  color: #bfdbfe;
}

body.theme-dark .attachment-card__badge {
  background: #111827;
  color: #e2e8f0;
}

body.theme-dark .history-modal__dialog,
body.theme-dark .linked-modal__dialog,
body.theme-dark .calendar-note-modal__card {
  background: #0b1220;
  color: #e2e8f0;
  border-color: #1f2937;
}

.app-footer {
  padding: 1.25rem 2rem;
  font-size: 0.85rem;
  color: #6b7280;
  text-align: right;
}

.page-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  max-width: none;
  margin-right: auto;
}

.page-container.compact-ui {
  gap: 0.4rem;
  margin-top: 0;
  margin-bottom: 1rem;
}

.compact-ui .section-header {
  padding-bottom: 0.2rem;
}

.compact-ui .section-header {
  gap: 0.4rem;
  margin-top: 0;
}

.compact-ui .actions {
  gap: 0.6rem;
}

.compact-ui .btn-primary,
.compact-ui .btn-secondary,
.compact-ui .btn-tertiary {
  font-size: 0.78rem;
  padding: 0.5rem 0.8rem;
  line-height: 1;
}

.compact-ui .form-label {
  font-size: 0.7rem;
  margin-bottom: 0.2rem;
}

.compact-ui .form-control {
  height: 28px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  line-height: 1.15;
}

.compact-ui .detail-list dt {
  font-size: 0.7rem;
}

.compact-ui .detail-list dd {
  font-size: 0.85rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section-header .actions {
  align-items: center;
}

.section-header .btn-primary,
.section-header .btn-secondary,
.section-header .btn-tertiary {
  margin-top: 0 !important;
  top: auto !important;
}

.h2h-page .h2h-section-header {
  align-items: center;
  min-height: auto;
  padding-top: 0.25rem;
  padding-bottom: 0.35rem;
  margin-top: 0;
}

.section-header h2,
.section-header h1 {
  margin: 0;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section--tight {
  gap: 0.35rem;
}

.page-container .section + .section {
  margin-top: 1.5rem;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.detail-section__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
}

.detail-section--a4 {
  max-width: 100%;
}

.detail-section--involved {
  width: 1050px;
  max-width: 1050px;
}

.detail-section--involved .card {
  width: 1050px;
  max-width: 1050px;
}

.form-card--narrow {
  width: 100%;
  max-width: 1200px;
  margin-right: auto;
}

.photo-attachments .attachment-empty {
  text-align: center;
}

.photo-attachments .attachment-preview-grid {
  justify-items: center;
  justify-content: center;
}

.directory-edit-form .photo-attachments {
  max-width: 190px;
  padding: 0.55rem 0.6rem;
  border-radius: 0.85rem;
  gap: 0.35rem;
}

.directory-edit-form .photo-attachments .handover-attachments__header {
  justify-content: flex-start;
  align-items: flex-start;
  gap: 0.3rem;
}

.directory-edit-form .photo-attachments .handover-attachments__actions {
  gap: 0.25rem;
  margin-top: 0;
  flex-wrap: wrap;
}

.directory-edit-form .photo-attachments .handover-attachments__actions .btn-secondary {
  padding: 0.32rem 0.45rem;
  font-size: 0.68rem;
  line-height: 1;
  min-height: 24px;
}

.directory-edit-form .photo-attachments .attachment-preview-grid {
  grid-template-columns: repeat(2, 92px);
  gap: 0.25rem;
  justify-content: center;
  width: auto;
  margin-top: 0.05rem;
}

.directory-edit-form .photo-attachments .attachment-card {
  width: 92px;
  padding: 0.45rem;
  justify-self: center;
}

.directory-edit-form .photo-attachments .attachment-card__preview {
  border-radius: 0.65rem;
}

.directory-edit-form .photo-attachments .attachment-card--main {
  width: 132px;
  grid-column: 1 / -1;
}

.directory-edit-form .photo-attachments .attachment-card--main .attachment-card__preview {
  width: 120px;
  height: 120px;
  aspect-ratio: auto;
}

.directory-edit-form .photo-attachments .attachment-empty {
  padding: 0.75rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.25;
}

.directory-edit-form .photo-attachments .attachment-empty p {
  margin: 0;
}

.grid {
  display: grid;
  gap: 1.25rem;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.category-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: #ffffff;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.card--compact {
  padding: 0.85rem 1rem;
}

.card--compact h2 {
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-card h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: #111827;
}

.category-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.card-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.badge {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 0;
}

.card-metrics div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.card-metrics dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #9ca3af;
}

.card-metrics dd {
  margin: 0;
  font-weight: 700;
  font-size: 1rem;
}

.table-card {
  overflow-x: auto;
  padding: 0;
}

.report-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  padding: 1.25rem;
}

.report-chart__header h3 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
}

.report-chart__body {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin-top: 0.6rem;
}

.report-chart__canvas {
  position: relative;
  width: 176px;
  height: 176px;
  display: grid;
  place-items: center;
}

.report-chart__canvas canvas {
  width: 176px;
  height: 176px;
}

.report-chart__empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  color: #6b7280;
  text-align: center;
  padding: 1rem;
}

.report-chart__empty[hidden] {
  display: none;
}

.report-chart__legend {
  display: grid;
  gap: 0.4rem;
  min-width: 160px;
  font-size: 0.9rem;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-value {
  margin-left: auto;
  font-weight: 600;
}

.legend-total {
  margin-top: 0.35rem;
  font-weight: 700;
}

.legend-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  display: inline-block;
}

.legend-swatch--daily {
  background: #2563eb;
}

.legend-swatch--incident {
  background: #f97316;
}

.legend-swatch--visitor {
  background: #22c55e;
}

@media (max-width: 720px) {
  .report-chart__body {
    flex-direction: column;
    align-items: flex-start;
  }

  .report-chart__canvas {
    width: 144px;
    height: 144px;
  }

  .report-chart__canvas canvas {
    width: 144px;
    height: 144px;
  }
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: inherit;
}

.data-table thead {
  background: #f3f4f6;
  text-transform: none;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}

.data-table th,
.data-table td {
  padding: 1rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.status-pill--open {
  background: #d1fae5;
  color: #065f46;
}

.status-pill--pending {
  background: #fef3c7;
  color: #92400e;
}

.status-pill--closed {
  background: #fee2e2;
  color: #991b1b;
}

body.theme-dark .status-pill--open {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
}

body.theme-dark .status-pill--pending {
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}

body.theme-dark .status-pill--closed {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.data-table--compact {
  font-size: 0.78rem;
}

.data-table--compact th,
.data-table--compact td {
  padding: 0.55rem 0.85rem;
}

.data-table--patrons {
  font-family: inherit;
  font-size: 0.82rem;
}

.data-table--patrons th,
.data-table--patrons td {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  font-size: 0.82rem;
  line-height: 1.2;
  font-weight: 400;
}

.data-table--reports {
  font-size: 0.85rem;
  table-layout: fixed;
}

.data-table--reports th,
.data-table--reports td {
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
}

.data-table--reports th {
  vertical-align: middle;
}

.column-header-inline,
.sortable-header {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  max-width: 100%;
  white-space: nowrap;
}

.sortable-header {
  color: inherit;
  text-decoration: none;
}

.sortable-header:hover {
  color: #2563eb;
}

.sortable-header.is-active {
  color: #1d4ed8;
}

.sort-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.85rem;
  font-size: 0.72rem;
  color: #6b7280;
}

.table-header-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.column-filter__control {
  display: inline-block;
  width: 1.45rem;
  max-width: 1.45rem;
  min-width: 1.45rem;
  height: 1.35rem;
  margin: 0;
  padding: 0;
  border: 1px solid #d1d5db;
  border-radius: 0.35rem;
  background: #ffffff;
  color: #374151;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.2;
  text-indent: 2rem;
  cursor: pointer;
}

.column-filter__control.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.column-filter__control::placeholder {
  color: #9ca3af;
}

body.theme-dark .column-filter__control {
  border-color: rgba(148, 163, 184, 0.34);
  background: rgba(15, 23, 42, 0.84);
  color: #e5e7eb;
}

body.theme-dark .sortable-header:hover,
body.theme-dark .sortable-header.is-active {
  color: #93c5fd;
}

body.theme-dark .sort-indicator {
  color: #94a3b8;
}

body.theme-dark .column-filter__control.is-active {
  border-color: #60a5fa;
  background: rgba(37, 99, 235, 0.22);
  color: #bfdbfe;
}

body.theme-dark .column-filter__control::placeholder {
  color: #94a3b8;
}

.data-table--reports td {
  vertical-align: top;
  word-break: break-word;
}

.data-table--profile-related {
  font-family: inherit;
  font-size: 0.82rem;
}

.data-table--profile-related th,
.data-table--profile-related td {
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem !important;
  line-height: 1.2;
  font-weight: 400;
}

.data-table--reports th:nth-child(1) {
  width: 18%;
}

.data-table--reports th:nth-child(2),
.data-table--reports th:nth-child(9) {
  width: 10%;
}

.data-table--reports .cell-title {
  margin-bottom: 0.15rem;
  line-height: 1.2;
}

.data-table--reports .report-snippet {
  margin-top: 0.05rem;
  line-height: 1.2;
}

.data-table--reports .report-snippet > div + div {
  margin-top: 0.1rem;
}

.data-table--reports tbody tr.report-row--pending {
  background-color: #fff8d0;
}

.data-table--reports tbody tr.report-row--pending:hover {
  background-color: #fff2b0;
}

.data-table--reports tbody tr.report-row--closed {
  background-color: #f1f3f5;
}

.data-table--reports tbody tr.report-row--closed:hover {
  background-color: #e2e6ea;
}

body.theme-dark .data-table--reports tbody tr.report-row--pending {
  background-color: rgba(245, 158, 11, 0.12);
}

body.theme-dark .data-table--reports tbody tr.report-row--pending:hover {
  background-color: rgba(245, 158, 11, 0.18);
}

body.theme-dark .data-table--reports tbody tr.report-row--closed {
  background-color: rgba(148, 163, 184, 0.1);
}

body.theme-dark .data-table--reports tbody tr.report-row--closed:hover {
  background-color: rgba(148, 163, 184, 0.16);
}

body.theme-dark .data-table--handover tbody tr:nth-child(even) {
  background-color: rgba(148, 163, 184, 0.06);
}

body.theme-dark .data-table--handover tbody tr:nth-child(odd) {
  background-color: transparent;
}

.handover-shift-cell {
  text-align: center;
  font-weight: 600;
}

.data-table--handover th:nth-child(1),
.data-table--handover td:nth-child(1) {
  width: 28%;
}

.data-table--handover th:nth-child(2),
.data-table--handover td:nth-child(2),
.data-table--handover th:nth-child(5),
.data-table--handover td:nth-child(5) {
  width: 18%;
}

.data-table--handover th:nth-child(3),
.data-table--handover td:nth-child(3),
.data-table--handover th:nth-child(4),
.data-table--handover td:nth-child(4) {
  width: 18%;
}

.data-table--visitor th:nth-child(1),
.data-table--visitor td:nth-child(1) {
  width: 18%;
}

.data-table--visitor th:nth-child(2),
.data-table--visitor td:nth-child(2),
.data-table--visitor th:nth-child(3),
.data-table--visitor td:nth-child(3) {
  width: 16%;
}

.data-table--visitor th:nth-child(4),
.data-table--visitor td:nth-child(4),
.data-table--visitor th:nth-child(5),
.data-table--visitor td:nth-child(5) {
  width: 16%;
}

.data-table--visitor th:nth-child(6),
.data-table--visitor td:nth-child(6),
.data-table--visitor th:nth-child(7),
.data-table--visitor td:nth-child(7) {
  width: 17%;
}

.data-table--handover td {
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: #f9fafb;
}

body.theme-dark .data-table tbody tr:hover {
  background: rgba(148, 163, 184, 0.12);
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.78rem;
}

.table-pagination__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.table-pagination .disabled {
  opacity: 0.5;
  pointer-events: none;
}

.split-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.split-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

@media (max-width: 1100px) {
  .split-section {
    grid-template-columns: 1fr;
  }
}

.patron-avatar {
  width: 75px;
  height: 75px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.patron-avatar img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center;
  background: transparent;
  display: block;
}

.patron-avatar a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.patron-avatar__placeholder {
  font-weight: 600;
  font-size: 1.1rem;
  color: #4b5563;
}

.profile-avatar {
  width: 96px;
  height: 96px;
}

.profile-detail-card,
.profile-related-card {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}

.profile-detail-card h2,
.profile-related-card h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
}

.profile-detail-grid > div {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.profile-detail-card .muted {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
}

.profile-detail-card .muted + div {
  font-size: 14px;
  font-weight: 400;
  color: #111827;
  line-height: 1.5;
  word-break: break-word;
}

.profile-detail-card [style*="white-space: pre-wrap"] {
  font-size: 14px;
  font-weight: 400;
  color: #111827;
  line-height: 1.5;
}

.profile-detail-chip {
  background: #e5e7eb;
  border-radius: 9999px;
  padding: 0.18rem 0.55rem;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  color: #374151;
}

.patron-member-name {
  font-weight: 400;
  word-break: break-word;
}

.data-table--patrons tbody tr.patron-row--banned {
  background: #fdeaea;
}

.data-table--patrons tbody tr.patron-row--banned:hover {
  background: #f9dede;
}

.patron-card--banned {
  background: #fdeaea;
}

.patron-ban-flag {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b91c1c;
}

.patron-name-line {
  display: block;
  line-height: 1.2;
}

.patron-photo-cell {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-top: 0.15rem;
  padding-bottom: 0.15rem;
  padding-left: 0.25rem;
}

.employee-photo-cell {
  width: auto;
}

.employee-avatar {
  width: 75px;
  height: 75px;
}

.employee-row--terminated {
  background: #9ca3af;
  color: #374151;
  position: relative;
}

.employee-row--terminated td {
  color: #374151;
}

.employee-row--terminated a {
  color: #374151;
}

.employee-terminated-cell {
  vertical-align: middle;
}

.employee-terminated-cell__content {
  position: relative;
  display: inline-block;
  line-height: 1.2;
}

.employee-terminated-cell__date {
  display: inline-block;
}

.employee-row--terminated .terminated-flag {
  position: absolute;
  top: 100%;
  left: 0;
  display: block;
  margin-top: 0.15rem;
  font-size: 0.7rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.employee-card--terminated {
  background: #d1d5db;
  color: #374151;
}

.employee-card--terminated .muted {
  color: #6b7280;
}

.photo-field {
  grid-column: 1 / -1;
}

.photo-input {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.photo-input__controls {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.photo-choice {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.profile-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.cell-title a {
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
}

.cell-title a:hover {
  text-decoration: underline;
}

.report-snippet {
  margin-top: 0.15rem;
  color: #6b7280;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.muted {
  font-size: 0.8rem;
  color: #9ca3af;
}

.table-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.table-actions--pager {
  margin-top: 0.75rem;
  justify-content: center;
}

.pager-page {
  min-width: 0.4rem;
  padding-left: 0.1rem;
  padding-right: 0.1rem;
}

.pager-page.is-active {
  background: #e5e7eb;
  color: #111827;
  cursor: default;
  pointer-events: none;
}

.empty {
  text-align: center;
  color: #6b7280;
}

.btn-primary,
.btn-secondary,
.btn-tertiary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}

.btn-xs {
  padding: 0.3rem 0.6rem;
  font-size: 0.7rem;
  border-radius: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background: #111827;
  color: #ffffff;
}

.btn-tertiary {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.btn-tertiary:hover,
.btn-primary:hover {
  opacity: 0.9;
}

.link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.link:hover {
  text-decoration: underline;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
  color: #6b7280;
  display: block;
  margin-bottom: 0.35rem;
}

.form-control,
select,
textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.85rem;
  color: #1f2937;
  box-sizing: border-box;
}

select.form-control:has(option:checked[value=""]) {
  color: #9ca3af;
  font-size: 0.8rem;
}

select.form-control:has(option:checked:not([value=""])) {
  color: #1f2937;
  font-size: 0.85rem;
}

.form-control:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(37, 99, 235, 0.2);
  border-color: #2563eb;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.combo-field {
  position: relative;
}

.combo-field__input {
  padding-right: 2.25rem;
}

.combo-field__toggle {
  position: absolute;
  top: 50%;
  right: 0.65rem;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
}

.combo-field__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;
  padding: 0.35rem;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.combo-field__option {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.45rem 0.6rem;
  border-radius: 0.5rem;
  cursor: pointer;
  color: #111827;
}

.combo-field__option:hover,
.combo-field__option:focus {
  background: #f3f4f6;
  outline: none;
}

.combo-field__option--hidden {
  display: none;
}

.person-linker {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.person-linker__title {
  font-weight: 600;
  font-size: 0.95rem;
}

.person-linker__intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.person-linker__question {
  font-size: 0.8rem;
  color: #6b7280;
}

.person-linker__selected-summary {
  font-size: 0.75rem;
  color: #9ca3af;
}

.person-summary-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-family: inherit;
  font-size: 14px;
}

.person-card__details {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 0.6rem !important;
  row-gap: 0.3rem;
  justify-content: start;
  font-family: inherit;
}

.person-card__detail {
  display: grid;
  gap: 0.15rem;
  font-family: inherit;
  font-size: 14px;
  color: #111827;
  font-weight: 400;
  min-width: 0;
  word-break: break-word;
  align-content: start;
  line-height: 1.45;
}

.person-card__detail span:first-child {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  min-width: 110px;
  display: inline-block;
}

.person-card__detail span:last-child {
  white-space: pre-wrap;
  color: #111827;
  font-size: 14px;
  font-weight: 400;
}

.person-card__detail--span-2 {
  grid-column: span 2;
}

.person-card__detail--span-3 {
  grid-column: span 3;
}

.person-card__detail--span-4 {
  grid-column: span 4;
}

.person-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
  width: 100%;
  justify-content: flex-start;
}

.person-card__chip {
  background: #e5e7eb;
  border-radius: 9999px;
  padding: 0.18rem 0.55rem;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  color: #374151;
}

.person-card__notes {
  white-space: pre-wrap;
  color: #374151;
}

.person-card--summary .person-card__action .btn-tertiary {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
}

.person-linker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.person-linker__grid[hidden] {
  display: none !important;
}

.people-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1200;
}

.people-modal.open {
  display: flex;
}

.people-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.people-modal__dialog {
  position: relative;
  background: #ffffff;
  border-radius: 1rem;
  width: min(720px, 92vw);
  max-height: 85vh;
  padding: 1.1rem;
  display: grid;
  gap: 0.85rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
  overflow: auto;
}

.people-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.people-modal__title {
  font-weight: 700;
  font-size: 1rem;
}

.people-modal__close {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
}

.people-modal__tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.people-tab {
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
  color: #374151;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.people-tab.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.people-modal__section {
  display: grid;
  gap: 0.5rem;
}

.people-modal__section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #4b5563;
}

.person-panel {
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: #ffffff;
  display: grid;
  gap: 0.6rem;
}

.person-panel__header {
  display: grid;
  gap: 0.5rem;
}

.person-panel__title {
  font-weight: 600;
  font-size: 0.9rem;
}

.person-panel__results,
.person-panel__selected {
  display: grid;
  gap: 0.5rem;
}

.person-empty {
  font-size: 0.75rem;
  color: #9ca3af;
}

.person-card {
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.5rem;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.person-card__avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #6b7280;
  overflow: hidden;
}

.person-card__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person-card.person-card--summary .person-card__avatar img {
  object-fit: contain;
  background: #f3f4f6;
}

.person-card__info {
  min-width: 0;
}

.person-card__title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.1rem;
}

.person-card__status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.1rem;
}

.person-card__flag {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #f3f4f6;
  color: #374151;
}

.person-card__flag--ban {
  background: #fdeaea;
  color: #b91c1c;
}

.person-card__flag--terminated {
  background: #e5e7eb;
  color: #374151;
}

.person-card__meta {
  font-size: 0.7rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-card__action {
  display: flex;
  align-items: center;
  justify-self: end;
}

.person-card--banned {
  background: #fdeaea;
}

.person-card--terminated {
  background: #e5e7eb;
}

.person-card.person-card--summary {
  grid-template-columns: 85px 90px minmax(0, 1fr) max-content;
  align-items: center;
  column-gap: 0.35rem;
  padding-right: 0.6rem;
}

.person-card.person-card--summary .person-card__avatar {
  width: 90px;
  height: 90px;
  border-radius: 12px;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.person-card__role {
  display: flex;
  align-items: center;
  align-self: center;
}

.person-card__role .form-control {
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  width: 85px;
}

.person-role-select {
  font-size: 0.7rem;
  padding: 0.3rem 0.5rem;
}

.compact-ui .person-role-select {
  font-size: 0.6rem;
  padding: 0.2rem 0.35rem;
  height: 26px;
}

.person-role-display {
  font-size: 0.85rem;
}

.person-card.person-card--summary .person-card__info {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
  justify-self: start;
  width: 100%;
}

.person-card.person-card--summary .person-card__action .btn-tertiary {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
}

.person-card.person-card--summary .person-card__action {
  margin-right: 0.2rem;
}

.person-list {
  display: grid;
  gap: 0.5rem;
}

.person-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background: #ffffff;
  align-items: center;
}

.person-item__avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #6b7280;
  overflow: hidden;
}

.person-item__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person-item__info {
  min-width: 0;
}

.person-item__name {
  font-weight: 600;
  font-size: 0.85rem;
}

.person-item__meta {
  font-size: 0.7rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.remember-row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.form-check-input {
  width: 1rem;
  height: 1rem;
}

.filter-form {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.filter-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.filter-grid--directory .filter-field--search {
  max-width: 200px;
}

.filter-grid--directory .filter-field--search .form-control {
  width: 100%;
  max-width: 200px;
  height: 34.52px;
}

.filter-grid--directory-inline {
  grid-template-columns: max-content max-content;
  align-items: end;
  justify-content: flex-start;
  column-gap: 0.5rem;
}

.filter-grid--directory-inline .filter-field--search {
  max-width: 220px;
}

.filter-grid--directory-inline .filter-field--search .form-control {
  max-width: 220px;
}

.filter-grid--directory-inline .filter-actions--inline {
  margin-bottom: 0.05rem;
}

.filter-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(140px, max-content));
  justify-content: flex-start;
  align-items: end;
  row-gap: 0.5rem;
  column-gap: 1rem;
}

.filter-grid--logs {
  grid-template-columns: repeat(auto-fit, minmax(140px, max-content));
  align-items: end;
  column-gap: 1rem;
  row-gap: 0.5rem;
}

.filter-grid--logs .filter-field--range .form-control {
  width: 180px;
  max-width: 180px;
  height: 34.52px;
}

.filter-grid--logs .incident-datetime-input {
  width: 180px;
  min-width: 180px;
  font-size: 0.85rem;
  padding-left: 0.55rem;
  padding-right: 2rem;
}

.filter-grid--logs .filter-field--search {
  margin-left: -38px;
}

.filter-grid--logs .filter-field--search .form-control {
  width: 200px;
  max-width: 200px;
  height: 34.52px;
  margin-right: 0;
}

.filter-grid--logs select.form-control {
  max-width: 140px;
}

.filter-grid--logs .filter-field--status {
  width: 102px;
  max-width: 102px;
  min-height: auto;
}

.filter-grid--logs .filter-field--status .form-label {
  width: 102px;
  height: auto;
  line-height: normal;
}

.filter-grid--logs select[name="Status"] {
  width: 102px;
  max-width: 102px;
  height: 34.52px;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.incident-grid {
  display: grid;
  gap: 0.75rem;
}

.incident-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(140px, max-content));
  align-items: end;
}

.incident-grid--wide {
  grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
  align-items: end;
}

.incident-status {
  width: 170px;
  max-width: 170px;
}

.incident-row {
  display: grid;
  gap: 0.75rem;
  align-items: end;
}

.incident-row--two {
  grid-template-columns: minmax(220px, 1fr) minmax(140px, max-content);
}

.incident-row--five {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  column-gap: 0.5rem;
  row-gap: 0.35rem;
}

.incident-meta__header {
  margin-bottom: 0.35rem;
}

.incident-meta__header--aligned {
  grid-template-columns: repeat(4, 170px);
  align-items: center;
}

.incident-meta__primary {
  display: grid;
  grid-template-columns: repeat(4, 170px);
  gap: 1rem;
  align-items: end;
}

.incident-meta__primary:not(.incident-meta__primary--daily) {
  grid-template-columns: repeat(4, 170px);
}

.incident-meta__primary--daily {
  grid-template-columns: repeat(3, 170px);
}

.incident-meta {
  font-size: 0.85rem;
}

.incident-meta .form-label {
  font-size: 0.7rem;
  margin-bottom: 0.2rem;
}

.incident-meta .form-control {
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  line-height: 1.15;
  height: 28px;
  width: 170px;
}

.incident-meta select.form-control,
.incident-meta select.form-control:has(option:checked[value=""]),
.incident-meta select.form-control:has(option:checked:not([value=""])) {
  font-size: 0.85rem;
}

.incident-meta .handover-title-display,
.incident-meta .incident-status-input {
  height: 28px;
}

.incident-meta .visitor-department-field,
.incident-meta .visitor-department-field .form-control {
  width: 170px;
  max-width: 170px;
}

.incident-meta .visitor-department-field .form-control {
  min-width: 170px;
}

.incident-meta__header {
  margin-bottom: 0.2rem;
  gap: 0.5rem;
}

.incident-meta__primary {
  gap: 0.5rem;
}

.incident-row--visitor-three {
  grid-template-columns: repeat(3, 170px);
  gap: 0.5rem 0.5rem;
}

.incident-row--visitor-four {
  grid-template-columns: repeat(4, 170px);
  gap: 0.5rem 0.5rem;
}

.incident-row--visitor-two {
  grid-template-columns: repeat(2, 170px);
  gap: 0.5rem 0.5rem;
}

.incident-meta--visitor .form-control,
.incident-meta--visitor .handover-title-display {
  width: 170px;
  max-width: 170px;
  color: #1f2937;
}

.incident-meta--visitor .datetime-field {
  width: 170px;
  max-width: 170px;
}

.report-form--compact .incident-meta--visitor .form-control {
  height: 28px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  line-height: 1.15;
}

.incident-field-stack {
  gap: 0.35rem;
}

.incident-field-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.incident-meta__secondary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  column-gap: 0.85rem;
  row-gap: 0.35rem;
  align-items: end;
  margin-top: 0.35rem;
}

.incident-row--daily-header {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.incident-status .incident-status-input {
  width: 170px;
  max-width: 170px;
  height: 28px;
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

.lostfound-form-layout {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: nowrap;
  gap: 1rem;
  align-items: start;
}

.lostfound-form-layout__left,
.lostfound-form-layout__right {
  min-width: 0;
  display: grid;
  gap: 0.7rem;
}

.lostfound-form-layout__left {
  flex: 0 0 340px;
  width: 340px;
  max-width: 340px;
}

.lostfound-form-layout__right {
  flex: 1 1 0;
  width: auto;
}

.lostfound-form-layout .handover-attachments {
  padding: 1rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.lostfound-form-layout .photo-attachments {
  width: 100%;
  justify-self: stretch;
}

.lostfound-form-layout .photo-attachments .handover-attachments__header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  justify-items: start;
}

.lostfound-form-layout .photo-attachments .handover-attachments__actions {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.45rem;
}

.lostfound-form-layout .photo-attachments .attachment-preview-grid,
.lostfound-form-layout .attachment-preview-grid {
  margin-top: 0.45rem;
  gap: 0.55rem;
  justify-items: stretch;
  justify-content: flex-start;
  width: 100%;
  min-height: 360px;
}

.lostfound-form-layout .photo-attachments .attachment-preview-grid.attachment-preview-grid--contain,
.lostfound-form-layout .attachment-preview-grid.attachment-preview-grid--contain {
  grid-template-columns: repeat(auto-fill, minmax(88px, 88px));
  justify-content: flex-start;
  align-items: start;
}

.lostfound-form-layout .photo-attachments .attachment-card,
.lostfound-form-layout .attachment-card {
  width: 88px;
  max-width: 88px;
  padding: 0.45rem;
}

.lostfound-form-layout .photo-attachments .attachment-card--main,
.lostfound-form-layout .attachment-card--main {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 100%;
  padding: 0.75rem;
}

.lostfound-form-layout .photo-attachments .attachment-card__preview,
.lostfound-form-layout .attachment-card__preview {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 0.9rem;
}

.lostfound-form-layout .photo-attachments .attachment-card--main .attachment-card__preview,
.lostfound-form-layout .attachment-card--main .attachment-card__preview {
  aspect-ratio: 4 / 3;
}

.lostfound-form-layout .attachment-card__preview img {
  object-fit: contain !important;
}

.lostfound-form-layout .incident-meta {
  font-size: 0.85rem;
}

.lostfound-form-grid {
  display: grid;
  gap: 0.5rem;
  align-items: end;
}

.lostfound-form-grid--two {
  grid-template-columns: repeat(2, minmax(170px, 1fr));
}

.lostfound-form-grid--three {
  grid-template-columns: repeat(3, minmax(170px, 1fr));
}

.lostfound-form-grid--four {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.lostfound-form-grid--seven {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.lostfound-form-grid--one,
.lostfound-form-grid--type {
  grid-template-columns: minmax(0, 1fr);
}

.lostfound-form-grid--type {
  max-width: none;
  margin: 0.55rem 0;
}

.lostfound-type-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  min-height: 32px;
}

.lostfound-type-option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: #111827;
  font-size: 0.9rem;
  font-weight: 400;
  cursor: pointer;
}

.lostfound-type-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #2563eb;
}

.lostfound-form-layout__left .lostfound-form-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lostfound-form-grid .form-group {
  margin: 0;
}

.lostfound-form-grid .form-group--span-2 {
  grid-column: span 2;
}

.lostfound-form-grid .form-group--span-3 {
  grid-column: 1 / -1;
}

.lostfound-form-grid .form-group--span-all {
  grid-column: 1 / -1;
}

.lostfound-type-panel {
  display: grid;
  gap: 0.55rem;
}

.lostfound-type-panel[hidden] {
  display: none;
}

.lostfound-form-layout .incident-meta .form-control,
.lostfound-form-layout .incident-meta .datetime-field {
  width: 100%;
  max-width: none;
  min-width: 0;
}

.lostfound-remark-field {
  grid-column: 1 / -1;
}

.lostfound-remark-field .form-control {
  min-height: 120px;
  resize: vertical;
}

.lf-multiline-field {
  min-height: 5.75rem;
  height: auto;
  line-height: 1.45;
  resize: vertical;
}

.incident-field--narrow .form-control {
  width: 170px;
  max-width: none;
  min-width: 170px;
  height: 28px;
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

.incident-field--area .form-control,
.incident-field--location .form-control {
  width: 170px;
  max-width: none;
  min-width: 170px;
}

.incident-daily-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  grid-template-areas:
    "start end category"
    "area location .";
  column-gap: 1rem;
  row-gap: 0.75rem;
  align-items: end;
}

@media (max-width: 1200px) {
  .lostfound-form-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .lostfound-form-layout__left {
    flex: none;
    width: 100%;
    max-width: none;
  }

  .lostfound-form-layout__right {
    flex: none;
    width: 100%;
  }
}

@media (max-width: 760px) {
  .lostfound-form-grid--two,
  .lostfound-form-grid--three,
  .lostfound-form-grid--four,
  .lostfound-form-grid--seven {
    grid-template-columns: 1fr;
  }

  .lostfound-form-grid .form-group--span-2,
  .lostfound-form-grid .form-group--span-all {
    grid-column: 1 / -1;
  }
}

.incident-daily-grid--daily-log {
  grid-template-columns: repeat(4, 170px);
  column-gap: 0.5rem;
  grid-template-areas: "start end category location";
}

.incident-daily-field--start {
  grid-area: start;
}

.incident-daily-field--end {
  grid-area: end;
}

.incident-daily-field--category {
  grid-area: category;
}

.incident-daily-field--area {
  grid-area: area;
}

.incident-daily-field--location {
  grid-area: location;
}

.incident-daily-grid .incident-category-input {
  width: 100%;
  max-width: none;
}

.daily-log-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  column-gap: 0.75rem;
  row-gap: 0.5rem;
  align-items: end;
}

.daily-log-meta .form-group--compact {
  min-width: 200px;
}

.daily-log-location .form-control {
  max-width: none;
  width: 100%;
}

.incident-category-input {
  width: 170px;
  max-width: 170px;
  height: 28px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
}

.datetime-field {
  position: relative;
  width: 100%;
}

.incident-datetime-input {
  width: 100%;
  min-width: 160px;
  height: 34.52px;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  padding-right: 2.5rem;
  font-size: 0.85rem;
  color: #1f2937;
}

.incident-meta__primary .incident-datetime-input {
  width: 160px;
  max-width: 160px;
}

.incident-meta__primary .datetime-field {
  width: 160px;
  max-width: 160px;
}

.incident-datetime-input::placeholder {
  font-size: 0.75rem;
  color: #9ca3af;
}

.visitor-datetime-field {
  width: 170px;
  max-width: 170px;
}

.visitor-datetime-field .incident-datetime-input {
  width: 170px;
  max-width: 170px;
  min-width: 170px;
}

.visitor-datetime-field .incident-datetime-input::placeholder {
  font-size: 0.75rem;
}

.datetime-picker-trigger {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #9ca3af;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  height: 1.5rem;
  width: 1.5rem;
}

.datetime-picker-trigger:hover,
.datetime-picker-trigger:focus-visible {
  color: #2563eb;
}

.datetime-picker-trigger__icon {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.date-time-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  width: 220px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
  padding: 0.75rem;
  display: none;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 30;
}

.date-time-panel.is-open {
  display: flex;
}

.date-time-panel__row,
.date-time-panel__time-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.date-time-panel__time-row {
  align-items: flex-end;
}

.date-time-panel__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}

.date-time-panel__date {
  flex: 0 0 120px;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.45rem 0.5rem;
  font-size: 0.9rem;
}

.date-time-panel__date:focus,
.date-time-panel__time-input:focus {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  border-color: #2563eb;
}

.date-time-panel__time-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.date-time-panel__time-input {
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  padding: 0.4rem 0.45rem;
  text-align: center;
  font-size: 0.95rem;
  width: 56px;
}

.date-time-panel__separator {
  font-weight: 600;
  padding-bottom: 0.4rem;
  color: #4b5563;
}

.date-time-panel__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.date-calendar-popover {
  position: absolute;
  z-index: 40;
  width: 260px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
  padding: 0.75rem;
  display: none;
  flex-direction: column;
  gap: 0.6rem;
}

.date-calendar-popover[aria-hidden="false"] {
  display: flex;
}

.date-calendar-popover__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.date-calendar-popover__month {
  font-weight: 600;
  font-size: 0.9rem;
}

.date-calendar-popover__nav {
  border: none;
  background: #e5e7eb;
  color: #374151;
  border-radius: 0.5rem;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.date-calendar-popover__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  font-size: 0.7rem;
  color: #6b7280;
  text-transform: uppercase;
}

.date-calendar-popover__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}

.date-calendar-popover__day {
  border: none;
  background: #f8fafc;
  border-radius: 0.4rem;
  padding: 0.35rem 0;
  font-size: 0.8rem;
  cursor: pointer;
  color: #1f2937;
}

.date-calendar-popover__day.is-muted {
  color: #9ca3af;
  background: #f3f4f6;
}

.date-calendar-popover__day.is-today {
  border: 1px solid #2563eb;
  background: #e0ecff;
}

.date-time-panel__button {
  border: none;
  border-radius: 0.6rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: #e5e7eb;
  color: #374151;
}

.date-time-panel__button--apply {
  background: #2563eb;
  color: #ffffff;
}

.date-time-panel__button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.3);
  outline-offset: 2px;
}

.filter-actions {
  display: flex;
  gap: 0.75rem;
}

.filter-actions--logs {
  align-self: end;
  margin: 0;
  gap: 0.5rem;
}

.filter-actions .btn-primary,
.filter-actions .btn-tertiary {
  height: 34.52px;
  max-height: 34.52px;
  min-height: 34.52px;
  padding-top: 0;
  padding-bottom: 0;
}

.filter-actions--inline {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.filter-form--compact .filter-date-field {
  max-width: 180px;
}

.filter-form--compact .form-group {
  margin-bottom: 0.15rem;
}

.filter-form--compact .filter-field {
  min-width: 0;
}

.filter-form--compact .filter-field--range .form-control {
  max-width: 180px;
}

.filter-form--compact .filter-field--search .form-control {
  min-width: 200px;
}

.filter-grid--compact .filter-field--range .form-control {
  width: 180px;
  max-width: 180px;
  height: 34.52px;
}

.filter-grid--compact .filter-field--search .form-control {
  width: 200px;
  max-width: 200px;
  height: 34.52px;
}

.filter-date-field {
  position: relative;
  display: block;
}

.filter-date-field .form-control {
  width: 100%;
  font-size: 0.85rem;
  color: #1f2937;
}

.filter-date-field .form-control::placeholder {
  font-size: 0.75rem;
  color: #9ca3af;
}

.filter-field--search .form-control {
  font-size: 0.85rem;
  color: #1f2937;
}

.filter-field--search .form-control::placeholder {
  font-size: 0.75rem;
  color: #9ca3af;
}

.filter-date-field--picker .form-control {
  padding-right: 2.85rem;
}

.filter-date-field--picker .date-picker-trigger {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  border-radius: 999px;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease, transform 0.15s ease;
}

.filter-date-field--picker .date-picker-trigger:hover,
.filter-date-field--picker .date-picker-trigger:focus {
  color: #1d4ed8;
  transform: translateY(-50%) scale(1.05);
}

.filter-date-field--picker .datetime-picker-trigger {
  transform: translateY(-50%);
}

.filter-date-field--picker .date-picker-trigger:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.3);
  outline-offset: 2px;
}

.date-picker-trigger__icon {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.date-picker-native {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
  border: 0;
  padding: 0;
  margin: 0;
}

.btn-tertiary:focus,
.btn-primary:focus {
  outline: 3px solid rgba(37, 99, 235, 0.3);
  outline-offset: 2px;
}

@media (max-width: 960px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .nav-item {
    flex: 1 0 45%;
    text-align: center;
  }

  .app-content {
    padding: 1.5rem;
  }

  .top-tabs {
    padding: 0.35rem 1rem 0.2rem;
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .top-tab {
    flex: 1 0 auto;
  }

  .top-tabs__left {
    flex: 1 1 100%;
    flex-wrap: wrap;
  }

  .top-tabs__right {
    flex: 1 1 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    padding-bottom: 0.6rem;
  }

  .workspace-switch-form {
    width: 100%;
  }
}

@media (min-width: 1680px) {
  .app-header {
    padding-left: 2rem;
    padding-right: 1rem;
  }

  .top-tabs {
    padding-left: 2rem;
    padding-right: 1rem;
  }

  .app-content {
    padding-top: var(--ui-desktop-content-pad-y);
    padding-right: 0.85rem;
    padding-bottom: var(--ui-desktop-content-pad-y);
    padding-left: 2rem;
  }

  .page-container {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-right: 0.35rem;
    gap: var(--ui-desktop-page-gap);
  }

  .section {
    gap: 1rem;
  }

  .page-container .section + .section {
    margin-top: 1rem;
  }
}

@media (min-width: 1920px) {
  .h2h-page,
  .roster-page {
    gap: 1rem;
  }

  .h2h-table-wrap,
  .roster-table-wrap {
    padding: 0.35rem;
  }

  .h2h-table {
    font-size: 0.72rem;
  }

  .h2h-scoreboard {
    margin-top: 10px;
    padding: 12px;
  }

  .h2h-meta-row__grid {
    column-gap: 0.18rem;
    row-gap: 0.28rem;
  }

  .h2h-meta-row__item {
    grid-template-columns: 82px minmax(0, 1fr);
    column-gap: 0.1rem;
  }

  .roster-col-name-def,
  .roster-header-name {
    width: 180px;
    min-width: 180px;
  }

  .roster-col-day-def,
  .roster-header-day,
  .roster-header-weekday,
  .roster-cell {
    width: 28px;
    min-width: 28px;
    max-width: 28px;
  }

  .roster-col-do-def,
  .roster-col-al-def,
  .roster-col-do,
  .roster-col-al {
    width: 32px;
    min-width: 32px;
    max-width: 32px;
  }

  .roster-col-do {
    right: 32px;
  }

  .data-table--reports th,
  .data-table--reports td {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }

  .report-body {
    font-size: 0.95rem;
    line-height: 1.5;
  }
}

@media (min-width: 2560px) {
  .app-content {
    padding-right: 0.65rem;
  }
}

.roster-page {
  gap: 1.2rem;
}

.h2h-page {
  gap: 1.5rem;
}

.h2h-meta__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.25rem;
}

.h2h-meta-input {
  max-width: 220px;
}

.h2h-toggle {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.85rem;
}

.h2h-table-wrap {
  border: 1px solid #e5e7eb;
  border-radius: 0.85rem;
  background: #ffffff;
  overflow: visible;
  padding: 0.5rem;
}

.h2h-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1400px;
  font-size: 0.75rem;
}

.h2h-table th,
.h2h-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.1rem 0.15rem;
  text-align: center;
  background: #ffffff;
  white-space: nowrap;
  box-sizing: border-box;
}

.h2h-table thead tr:nth-child(2) th,
.h2h-table thead tr:nth-child(3) th {
  border-bottom: none;
}

.h2h-table thead tr:nth-child(2) th,
.h2h-table thead tr:nth-child(3) th,
.h2h-table thead tr:nth-child(2) th.h2h-bet-meta--empty,
.h2h-table thead tr:nth-child(3) th.h2h-bet-meta--empty {
  background: transparent;
}

.h2h-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 2;
}

.h2h-table thead tr:nth-child(1) th {
  top: 0;
  height: 92px;
  z-index: 5;
}

.h2h-table thead tr:nth-child(2) th {
  top: 92px;
  height: 56px;
  z-index: 4;
}

.h2h-table thead tr:nth-child(3) th {
  top: 148px;
  height: 34px;
  z-index: 3;
}

.h2h-table thead tr:nth-child(4) th {
  top: 182px;
  height: 34px;
  z-index: 2;
}

.h2h-bet-meta {
  padding: 0.2rem 0.3rem;
  text-align: left;
}

.h2h-bet-meta--border {
  border: 1px solid #d1d5db;
}


.h2h-bet-left-black {
  border-left: 2px solid #111827 !important;
}

.h2h-bet-right-black {
  border-right: 2px solid #111827 !important;
}

.h2h-bet-top-black {
  border-top: 2px solid #111827 !important;
}

.h2h-no-right {
  border-right: none !important;
}

.h2h-bet-left-span {
  border-left: 2px solid #111827 !important;
}

.h2h-bet-meta--empty {
  padding: 0;
  background: transparent;
  border: none;
}

.h2h-bet-meta__grid {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.6fr);
  gap: 0.35rem;
  align-items: center;
  justify-items: start;
}

.h2h-bet-meta__controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.h2h-meta-btn {
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  line-height: 1;
}

.h2h-bet-meta__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4b5563;
  margin: 0;
}

.h2h-bet-meta__input {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 0.35rem;
  padding: 0.25rem 0.3rem;
  font-size: 0.85rem;
  text-align: center;
  background: #ffffff;
  min-width: 140px;
}

.h2h-bet-meta__item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.h2h-bet-meta__input--wide {
  width: 260px;
}
.h2h-bet-meta__item .h2h-bet-meta__label {
  width: 110px;
  min-width: 110px;
  text-align: right;
}

.h2h-bet-meta__value {
  display: block;
  flex: 1 1 auto;
  box-sizing: border-box;
  min-width: 140px;
  width: 100%;
  padding: 0.25rem 0.3rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.35rem;
  font-size: 0.85rem;
  text-align: center;
  background: #ffffff;
}

.h2h-bet-meta__input:not(.h2h-bet-meta__input--wide),
.h2h-bet-meta__value {
  width: 150px;
  min-width: 150px;
  max-width: 150px;
  flex: 0 0 150px;
}

.h2h-meta-row {
  padding: 0.25rem 0.35rem;
  text-align: left;
}

.h2h-meta-row__grid {
  display: grid;
  grid-template-columns: repeat(7, max-content);
  column-gap: 0.25rem;
  row-gap: 0.35rem;
  align-items: start;
  justify-content: start;
  width: fit-content;
  margin-left: 0.2rem;
}

.h2h-meta-row__item {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  column-gap: 0.15rem;
  min-width: 0;
}

.h2h-meta-row__item--inline {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: nowrap;
  min-width: 0;
  justify-content: flex-start;
}

.h2h-meta-row__inline {
  display: inline-flex;
  align-items: center;
  gap: 0.175rem;
  min-width: 0;
}

.h2h-meta-row__inline .h2h-meta-row__label {
  min-width: 86px;
}

.h2h-meta-row__inline--toggle .h2h-meta-row__label {
  min-width: 86px;
  text-align: right;
}

.h2h-meta-row__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #4b5563;
  text-align: right;
  white-space: nowrap;
  line-height: 1.2;
}

.h2h-meta-row__input {
  border: 1px solid #e5e7eb;
  border-radius: 0.35rem;
  padding: 0.35rem 0.4rem;
  font-size: 0.9rem;
  text-align: center;
  background: #ffffff;
  width: 100%;
  min-width: 0;
  height: auto;
}

.h2h-meta-row__input--narrow-2-3 {
  width: 140px;
}

.h2h-meta-row__input--narrow-4-5 {
  width: 168px;
}

.h2h-meta-row__input--narrow-1-3 {
  width: 70px;
}

.h2h-meta-row__item.field-cut-by .h2h-meta-row__input {
  max-width: 220px;
}

.h2h-meta-row__item.field-h2h-writer .h2h-meta-row__input {
  max-width: 220px;
}

.h2h-meta-row__item.field-date,
.h2h-meta-row__item.field-dealer {
  margin-left: -0.72rem;
  margin-right: 0.72rem;
}

.h2h-meta-row__inline--toggle {
  margin-left: 0.32rem;
}



.h2h-meta-row__toggle {
  display: inline-flex;
  gap: 0.2rem;
  font-size: 0.85rem;
  align-items: center;
  white-space: nowrap;
  min-height: 0;
}

.h2h-meta-row__item {
  align-items: center;
}

.h2h-bet-title {
  text-align: center;
  font-weight: 700;
}

.h2h-title-row th {
  height: 34px;
  vertical-align: middle;
}

.h2h-title-row--top th {
  border-top: 2px solid #111827;
}

.h2h-types-row th {
  border-bottom: 2px solid #111827;
}

.h2h-types-bottom {
  border-bottom: 2px solid #111827 !important;
}

.h2h-col-a {
  border-left: 2px solid #111827;
}

.h2h-col-b-right {
  border-right: 2px solid #111827 !important;
}

.h2h-col-last {
  border-right: 2px solid #111827;
}

.h2h-table tbody tr:last-child td {
  border-bottom: 2px solid #111827;
}
.h2h-sheet-header,
.h2h-row-head,
.h2h-row-num {
  background: #f1f5f9;
  font-size: 0.6rem;
  font-weight: 600;
  color: #475569;
  text-align: center;
  white-space: nowrap;
}

.h2h-row-head,
.h2h-row-num {
  min-width: 26px;
  width: 26px;
}

.h2h-row-num--hidden {
  color: transparent;
}

.h2h-header-gray {
  background: #f3f4f6 !important;
}

.h2h-header-gray.h2h-coup {
  background: #f3f4f6 !important;
}

.h2h-head-spacer {
  background: #f8fafc;
}

.h2h-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #ffffff;
  min-width: 40px;
}

.h2h-number,
.h2h-flag,
.h2h-text {
  width: 64px;
  border: 1px solid #e5e7eb;
  border-radius: 0.35rem;
  padding: 0.1rem 0.15rem;
  font-size: 0.75rem;
  text-align: center;
}

.h2h-input--tiny {
  width: 26px;
}

.h2h-col--tiny {
  min-width: 14px;
  width: 14px;
}

.h2h-flag {
  width: 26px;
}

.h2h-total {
  font-weight: 600;
  min-width: 70px;
}

.h2h-header--wrap {
  white-space: normal;
  font-size: 0.7rem;
  line-height: 1.05;
}

.h2h-header--results {
  font-size: 0.54rem;
}

.h2h-coup {
  font-size: 0.65rem;
  padding-left: 0.15rem;
  padding-right: 0.15rem;
}

.h2h-coup-cell {
  background: #f3f4f6;
}

.h2h-calc-cell {
  background: #f3f4f6;
  font-size: 0.68rem;
  line-height: 1.1;
}

.h2h-patron-hidden {
  display: none !important;
}

.h2h-negative {
  color: #dc2626;
}

.h2h-border-left {
  border-left: 2px solid #111827;
}

.h2h-border-right {
  border-right: 2px solid #111827;
}

.h2h-border-right-double {
  border-right: 4px double #111827;
}

.h2h-border-left-gray {
  border-left: 1px solid #d1d5db;
}

.h2h-border-right-gray {
  border-right: 1px solid #d1d5db;
}

.h2h-border-top-gray {
  border-top: 1px solid #d1d5db;
}
.h2h-border-right-double-gray {
  border-right: 3px double #d1d5db;
}

.h2h-input--readonly {
  background: #f3f4f6;
  color: #6b7280;
}

.h2h-row--active td,
.h2h-row--active th,
.h2h-row--active .h2h-coup-cell {
  background: #eef1f5 !important;
}

.h2h-row--error {
  background: rgba(248, 113, 113, 0.15);
}

.h2h-page,
.h2h-page * {
  box-sizing: border-box;
}

.h2h-frame {
  border: 1px solid #d0d7e2;
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
}

.h2h-cell--error {
  border-color: #ef4444;
  background: rgba(248, 113, 113, 0.12);
}

.h2h-summary__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.h2h-summary {
  overflow-x: visible;
  padding: 12px 16px 16px;
  border-top: 1px solid #d0d7e2;
  background: #ffffff;
}

body.theme-dark .h2h-table {
  background: #0b1220;
  color: #e2e8f0;
}

body.theme-dark .h2h-table th,
body.theme-dark .h2h-table td {
  border-color: #1f2937;
  background: #0b1220 !important;
  color: #e2e8f0;
}

body.theme-dark .h2h-table thead tr:nth-child(2) th,
body.theme-dark .h2h-table thead tr:nth-child(3) th,
body.theme-dark .h2h-table thead tr:nth-child(2) th.h2h-bet-meta--empty,
body.theme-dark .h2h-table thead tr:nth-child(3) th.h2h-bet-meta--empty {
  background: #0b1220;
  color: #e2e8f0;
}

body.theme-dark .h2h-header-gray {
  background: #111827;
  color: #e2e8f0;
}

body.theme-dark .h2h-table thead th {
  background: #111827;
  color: #e2e8f0;
}

body.theme-dark .h2h-bet-meta,
body.theme-dark .h2h-bet-meta--empty {
  background: #0b1220;
  color: #e2e8f0;
}

body.theme-dark .h2h-bet-meta__label,
body.theme-dark .h2h-bet-meta__value {
  color: #e2e8f0;
}

body.theme-dark .h2h-bet-meta__value {
  background: #0b1220;
  border-color: #334155;
}

body.theme-dark .h2h-header--results {
  color: #e2e8f0;
}

body.theme-dark .h2h-coup-cell,
body.theme-dark .h2h-calc-cell,
body.theme-dark .h2h-input--readonly {
  background: #0f172a !important;
  color: #cbd5f5;
}

body.theme-dark .h2h-table .sticky-col {
  background: #0f172a;
}

body.theme-dark .h2h-head-spacer,
body.theme-dark .h2h-sheet-header,
body.theme-dark .h2h-row-head,
body.theme-dark .h2h-row-num {
  background: #0b1220;
  color: #cbd5f5;
}

body.theme-dark .h2h-number,
body.theme-dark .h2h-flag,
body.theme-dark .h2h-text,
body.theme-dark .h2h-meta-row__input,
body.theme-dark .h2h-bet-meta__input {
  background: #0b1220;
  border-color: #334155;
  color: #e2e8f0;
}

body.theme-dark .h2h-number:focus,
body.theme-dark .h2h-flag:focus,
body.theme-dark .h2h-text:focus,
body.theme-dark .h2h-meta-row__input:focus,
body.theme-dark .h2h-bet-meta__input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

body.theme-dark .h2h-row--active td,
body.theme-dark .h2h-row--active th,
body.theme-dark .h2h-row--active .h2h-coup-cell {
  background: #1f2937 !important;
}

body.theme-dark .h2h-bet-left-black,
body.theme-dark .h2h-bet-right-black,
body.theme-dark .h2h-bet-top-black,
body.theme-dark .h2h-bet-left-span,
body.theme-dark .h2h-border-left,
body.theme-dark .h2h-border-right,
body.theme-dark .h2h-border-right-double,
body.theme-dark .h2h-col-a,
body.theme-dark .h2h-col-b-right,
body.theme-dark .h2h-col-last,
body.theme-dark .h2h-title-row--top th,
body.theme-dark .h2h-types-row th,
body.theme-dark .h2h-types-bottom,
body.theme-dark .h2h-table tbody tr:last-child td {
  border-color: #334155 !important;
}

body.theme-dark .h2h-border-left-gray,
body.theme-dark .h2h-border-right-gray,
body.theme-dark .h2h-border-top-gray,
body.theme-dark .h2h-border-right-double-gray {
  border-color: #1f2937 !important;
}

body.theme-dark .h2h-summary {
  color: #e2e8f0;
}

.h2h-summary__grid--aligned {
  --h2h-summary-left: 0px;
  --h2h-summary-table-width: 100%;
  --h2h-bet-width: 0px;
  --h2h-result-width: 0px;
  --h2h-calc-width: 0px;
  display: grid !important;
  grid-template-columns:
    var(--h2h-summary-left)
    var(--h2h-bet-width)
    var(--h2h-result-width)
    var(--h2h-calc-width);
  column-gap: 0;
  row-gap: 8px;
  padding-left: 0;
  width: var(--h2h-summary-table-width, 100%);
}

.h2h-summary__spacer {
  display: block;
}

.h2h-summary__col--bet {
  grid-column: 2;
  margin-left: 0;
}

.h2h-summary__col--results {
  grid-column: 3;
  margin-left: 0;
}

.h2h-summary__col--calc {
  grid-column: 4;
  margin-left: 0;
}

.h2h-summary__col,
.h2h-summary__rows,
.h2h-summary__calc-grid{
  min-width: 0;
}

.h2h-summary__title {
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.h2h-summary__row {
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow-wrap: normal;
  line-height: 1.25;
}

.h2h-summary__rows,
.h2h-summary__rows--4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 18px;
  row-gap: 6px;
}

.h2h-summary__rows .h2h-summary__row {
  margin-bottom: 0;
}

.h2h-summary__calc-grid,
.h2h-summary__calc-grid--5 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 18px;
  row-gap: 6px;
}

/* ===== Force 4 columns in totals ===== */
.h2h-summary__col--bet .h2h-summary__rows,
.h2h-summary__col--results .h2h-summary__rows,
.h2h-summary__col--calc .h2h-summary__calc-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  column-gap: 18px;
  row-gap: 6px;
  align-items: start;
  min-width: 0;
}

.h2h-summary__col--calc .h2h-summary__total {
  grid-column: 1 / -1;
}

@media print {
  .h2h-summary__rows,
  .h2h-summary__rows--4,
  .h2h-summary__calc-grid,
  .h2h-summary__calc-grid--5 {
    column-gap: 14px;
    row-gap: 4px;
  }
}

.h2h-summary__total {
  font-size: 1rem;
}

.h2h-summary-bet {
  margin-left: -1.1rem;
}

.h2h-summary-results {
  margin-left: 0;
}

.h2h-summary-calculated {
  margin-left: 1.1rem;
}

.h2h-scoreboard {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #d0d7e2;
  border-radius: 14px;
  background: #ffffff;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  --banker-color: #e04b4b;
  --player-color: #3b7cff;
  --tie-color: #2bb673;
  --road-red: #e04b4b;
  --road-blue: #3b7cff;
  --board-bg: #f8fafc;
  --board-border: #aeb8c7;
}

.h2h-scoreboard.h2h-scoreboard--alt {
  --player-color: #e04b4b;
  --banker-color: #3b7cff;
}

/* =========================
   H2H PRINT OVERRIDES (A3)
   ========================= */
@media print {
  @page { size: A3 landscape; margin: 0; }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .page-container,
  .h2h-page,
  .h2h-print {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #h2h-print-root,
  #h2hPrintRoot {
    width: 100% !important;
    margin: 0 !important;
    padding: 6mm !important;
    box-sizing: border-box !important;
  }

  .h2h-frame,
  .h2h-table-wrap,
  .print-table-wrap,
  .h2h-scoreboard,
  .h2h-scoreboard__stack,
  .h2h-board {
    transform: none !important;
    zoom: 1 !important;
  }

  .h2h-table-wrap,
  .print-table-wrap {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
  }

  .sticky-col {
    position: static !important;
    left: auto !important;
  }

  .h2h-bet-meta__controls,
  [data-patron-add],
  [data-patron-remove] {
    display: none !important;
  }

  .h2h-table thead {
    display: table-row-group !important;
  }

  .print-totals,
  .print-scoreboard {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .h2h-summary__grid {
    width: var(--h2h-summary-table-width, 100%) !important;
    display: grid !important;
    grid-template-columns: var(--h2h-summary-left, 0px) var(--h2h-bet-width) var(--h2h-result-width) var(--h2h-calc-width) !important;
    align-items: start !important;
    justify-content: start !important;
  }

  .h2h-summary__spacer { display: block !important; }

  .h2h-summary__row { white-space: nowrap !important; }

  .h2h-scoreboard__stack {
    padding: 0 6mm 6mm 6mm !important;
    box-sizing: border-box !important;
  }
}

.h2h-board--eye,
.h2h-board--small,
.h2h-board--cockroach {
  --banker-color: #e04b4b;
  --player-color: #3b7cff;
}

.h2h-scoreboard__header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.h2h-scoreboard__toggle {
  margin-left: 12px;
}

.h2h-scoreboard__title {
  font-weight: 700;
  font-size: 0.95rem;
}

.h2h-scoreboard__toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
}

.h2h-scoreboard__stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: max-content;
}

.h2h-board-row {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 6px;
}

.h2h-board-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.h2h-board__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}

.h2h-board {
  position: relative;
  background: var(--board-bg);
  border: 1px solid var(--board-border);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  --h2h-board-rows: 6;
  --h2h-board-row: 26px;
  height: calc(var(--h2h-board-rows) * var(--h2h-board-row));
  min-width: calc(10 * var(--h2h-board-row));
  box-sizing: border-box;
}

.h2h-board::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

.h2h-board__grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--h2h-board-row);
  grid-template-rows: repeat(var(--h2h-board-rows), var(--h2h-board-row));
  gap: 0;
  min-height: auto;
  width: max-content;
  align-items: center;
  justify-items: center;
  position: relative;
}

.h2h-board__cell {
  width: 100%;
  height: 100%;
  border-right: 1px solid #aeb8c7;
  border-bottom: 1px solid #aeb8c7;
  box-sizing: border-box;
  z-index: 1;
}

.h2h-board__token-cell {
  z-index: 2;
}

.h2h-board--bigroad {
  --h2h-board-row: 28px;
  width: calc(66 * 28px);
  max-width: calc(66 * 28px);
}

.h2h-board--bigroad .h2h-board__grid {
  grid-auto-columns: var(--h2h-board-row);
  grid-template-rows: repeat(var(--h2h-board-rows), var(--h2h-board-row));
}

.h2h-board--bead {
  --h2h-board-row: 24px;
  width: calc(16 * 24px);
  line-height: 0;
}

.h2h-board--bead .h2h-board__grid {
  grid-auto-columns: var(--h2h-board-row);
  grid-template-rows: repeat(var(--h2h-board-rows), var(--h2h-board-row));
  align-items: center;
  justify-items: center;
}

.h2h-board--bigroad,
.h2h-board--bead {
  background-image:
    linear-gradient(to right, var(--board-border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--board-border) 1px, transparent 1px);
  background-size: var(--h2h-board-row) var(--h2h-board-row);
}

.h2h-board--eye,
.h2h-board--small,
.h2h-board--cockroach {
  background-image:
    linear-gradient(to right, var(--board-border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--board-border) 1px, transparent 1px);
  --h2h-board-rows: 6;
  --h2h-board-row: 14px;
  background-size: 28px 28px;
  width: calc(22 * 28px);
  max-width: calc(22 * 28px);
}

.h2h-board--eye .h2h-board__grid,
.h2h-board--small .h2h-board__grid,
.h2h-board--cockroach .h2h-board__grid {
  grid-auto-columns: var(--h2h-board-row);
  grid-template-rows: repeat(var(--h2h-board-rows), var(--h2h-board-row));
  gap: 0;
}

.h2h-road-dot {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
}

.h2h-board--bigroad .h2h-road-dot,
.h2h-board--bead .h2h-road-dot {
  width: calc(var(--h2h-board-row) - 8px);
  height: calc(var(--h2h-board-row) - 8px);
  margin: 0;
}

.h2h-board--bead .h2h-road-dot {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
}

.h2h-board--eye .h2h-road-dot,
.h2h-board--small .h2h-road-dot,
.h2h-board--cockroach .h2h-road-dot {
  width: 10px;
  height: 10px;
  margin: 0;
  transform: none;
}

.h2h-board--eye .h2h-road-dot--hollow-red,
.h2h-board--eye .h2h-road-dot--hollow-blue {
  border-width: 1px;
  box-sizing: border-box;
}

.h2h-road-dot--filled {
  background: var(--banker-color);
}

.h2h-road-dot--player {
  background: var(--player-color);
}

.h2h-road-dot--tie {
  background: transparent;
  border: 2px solid var(--tie-color);
}

.h2h-road-dot--tie-fill {
  background: var(--tie-color);
}

.h2h-road-dot__tie {
  position: absolute;
  width: 2px;
  height: 100%;
  background: var(--tie-color);
  transform: rotate(45deg);
}

.h2h-road-dot--hollow-red {
  border: 2px solid var(--road-red);
  background: transparent;
}

.h2h-road-dot--hollow-blue {
  border: 2px solid var(--road-blue);
  background: transparent;
}

.h2h-road-dot--slash-red::after,
.h2h-road-dot--slash-blue::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 100%;
  background: var(--road-red);
  transform: rotate(45deg);
}

.h2h-road-dot--slash-blue::after {
  background: var(--road-blue);
}

.h2h-board--cockroach .h2h-road-dot--slash-red::after,
.h2h-board--cockroach .h2h-road-dot--slash-blue::after {
  width: 3px;
}

.h2h-road-dot__tie-count {
  position: absolute;
  bottom: -2px;
  right: -4px;
  font-size: 0.55rem;
  color: var(--tie-color);
  font-weight: 700;
}

.h2h-pair-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--banker-color);
  top: 2px;
  left: 2px;
  box-shadow: 0 0 0 1px #fff;
}

.h2h-pair-dot--player {
  background: var(--player-color);
  right: 2px;
  left: auto;
}

body.theme-dark .h2h-scoreboard {
  --board-bg: #121826;
  --board-border: #2c3447;
}

body.theme-dark .h2h-board__label {
  color: #cbd5f1;
}

.roster-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.roster-month-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.roster-month-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.roster-month-form--dual {
  position: relative;
}

.roster-month-display {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.roster-month-picker {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.roster-month-text {
  min-width: 140px;
  text-align: center;
  padding-right: 2.25rem;
}

.roster-month-trigger {
  position: absolute;
  right: 0.45rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
}

.roster-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.roster-table-wrap {
  border: 1px solid #e5e7eb;
  border-radius: 0.85rem;
  background: #ffffff;
  overflow-x: auto;
  padding: 0.5rem;
}

.roster-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: max-content;
  table-layout: fixed;
  font-size: 0.85rem;
  --roster-header-row-height: 2.2rem;
}

.roster-col-name-def {
  width: 200px;
}

.roster-col-day-def {
  width: 30px;
}

.roster-col-do-def,
.roster-col-al-def {
  width: 35px;
}

.roster-table th,
.roster-table td {
  border-bottom: 1px solid #e5e7eb;
  border-right: 1px dashed rgba(148, 163, 184, 0.6);
  padding: 0.4rem 0.35rem;
  text-align: center;
  background: #ffffff;
}

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

.roster-header-name {
  min-width: 200px;
  text-align: left;
  z-index: 4;
}

.roster-header-day,
.roster-header-weekday {
  width: 30px;
  min-width: 30px;
  max-width: 30px;
  padding-left: 0.12rem !important;
  padding-right: 0.12rem !important;
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 4;
  height: var(--roster-header-row-height);
  box-sizing: border-box;
}

.roster-header-weekday {
  top: var(--roster-header-row-height);
  font-size: 0.75rem;
  color: #64748b;
}

.roster-sticky-left {
  position: sticky;
  left: 0;
  background: #ffffff;
  z-index: 3;
  text-align: left;
}

.roster-sticky-right {
  position: sticky;
  background: #ffffff;
  z-index: 3;
}

.roster-col-do {
  right: 35px;
  width: 35px;
  min-width: 35px;
  max-width: 35px;
  border-left: 2px solid #0f172a;
}

.roster-col-al {
  right: 0;
  width: 35px;
  min-width: 35px;
  max-width: 35px;
  border-right: 2px solid #0f172a;
}

.roster-cell {
  width: 30px;
  min-width: 30px;
  max-width: 30px;
  padding-left: 0.12rem !important;
  padding-right: 0.12rem !important;
}

.roster-select {
  width: 100%;
  min-width: 22px;
  border: 1px solid #e5e7eb;
  border-radius: 0.35rem;
  padding: 0.2rem 0.1rem;
  background: #ffffff;
  font-size: 0.8rem;
}

.roster-input {
  display: block;
  margin: 0 auto;
  width: 27px;
  min-width: 27px;
  max-width: 27px;
  border: 1px solid #e5e7eb;
  border-radius: 0.35rem;
  padding: 0.1rem 0;
  background: #ffffff;
  font-size: 0.8rem;
  text-align: center;
  text-transform: uppercase;
}

.roster-code {
  display: inline-block;
  width: 27px;
  min-width: 27px;
  max-width: 27px;
  overflow: hidden;
  white-space: nowrap;
}

.roster-input:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
}

.roster-select:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
}

.roster-select:disabled option {
  color: #9ca3af;
}

.roster-group-row th {
  background: #f1f5f9;
  font-weight: 700;
  text-align: left;
}

.roster-group-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-start;
}

.btn-small {
  font-size: 0.75rem;
  padding: 0.35rem 0.6rem;
}

.roster-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.roster-name-text {
  font-weight: 600;
}

.roster-remove {
  background: transparent;
  border: 1px solid #e5e7eb;
  border-radius: 0.4rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  color: #991b1b;
  cursor: pointer;
  display: none;
}

.roster-person-row.is-remove-mode .roster-remove {
  display: inline-flex;
}

.roster-cell.is-weekend,
.roster-header-day.is-weekend,
.roster-header-weekday.is-weekend {
  background: #ffffff;
}

.roster-header-day.is-monday,
.roster-header-weekday.is-monday,
.roster-cell.is-monday {
  border-left: 2px solid #0f172a;
}

.roster-header-day.is-sunday,
.roster-header-weekday.is-sunday,
.roster-cell.is-sunday {
  border-right: 0;
}

.roster-header-day.is-last-day,
.roster-header-weekday.is-last-day,
.roster-cell.is-last-day {
  border-right: 0;
}

.roster-cell.is-code-m {
  background: #fef9c3;
}

.roster-cell.is-code-d {
  background: #dcfce7;
}

.roster-cell.is-code-n {
  background: #ffedd5;
}

.roster-cell.is-disabled {
  background: #e5e7eb;
}

.roster-footer {
  display: flex;
  justify-content: flex-end;
}

body.theme-dark .roster-table-wrap {
  background: #0b1220;
  border-color: #1f2937;
}

body.theme-dark .roster-table th,
body.theme-dark .roster-table td {
  border-bottom-color: #1f2937;
  background: #0b1220;
  color: #e2e8f0;
}

body.theme-dark .roster-header-day,
body.theme-dark .roster-header-weekday {
  background: #111827;
}

body.theme-dark .roster-group-row th {
  background: #111827;
}

body.theme-dark .roster-select {
  background: #0b1220;
  border-color: #1f2937;
  color: #e2e8f0;
}

body.theme-dark .roster-cell.is-weekend,
body.theme-dark .roster-header-day.is-weekend,
body.theme-dark .roster-header-weekday.is-weekend {
  background: #1f2937;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 6mm;
  }

  html.roster-is-printing,
  html.roster-is-printing body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html.roster-is-printing .app-header,
  html.roster-is-printing .app-footer,
  html.roster-is-printing .roster-actions,
  html.roster-is-printing .roster-group-actions,
  html.roster-is-printing .roster-remove {
    display: none !important;
  }

  html.roster-is-printing .roster-month-controls {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
  }

  html.roster-is-printing .roster-month-controls > a,
  html.roster-is-printing .roster-month-form .btn-secondary,
  html.roster-is-printing .roster-month-trigger,
  html.roster-is-printing .roster-month-picker {
    display: none !important;
  }

  html.roster-is-printing .roster-month-form {
    margin: 0 !important;
  }

  html.roster-is-printing .roster-month-text {
    min-width: 96px !important;
    width: 96px !important;
    padding-right: 0.5rem !important;
    text-align: left !important;
    font-weight: 700;
    background: transparent !important;
    border: 0 !important;
  }

  html.roster-is-printing #rosterPrintRoot {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  html.roster-is-printing .roster-table-wrap {
    border: 0 !important;
    border-radius: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #ffffff !important;
  }

  html.roster-is-printing .roster-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    font-size: 9px !important;
  }

  html.roster-is-printing .roster-col-name-def {
    width: 150px !important;
  }

  html.roster-is-printing .roster-header-name {
    min-width: 150px !important;
    max-width: 150px !important;
  }

  html.roster-is-printing .roster-sticky-left,
  html.roster-is-printing .roster-sticky-right {
    position: static !important;
    left: auto !important;
    right: auto !important;
  }
}


.text-danger {
  color: #dc2626;
  font-size: 0.85rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
}

.form-subheading {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.detail-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

.detail-list div {
  display: grid;
  gap: 0.25rem;
}

.detail-list dt {
  font-size: 0.75rem;
  text-transform: none;
  color: #9ca3af;
  margin: 0;
}

.detail-list dd {
  margin: 0;
  font-weight: 600;
}

.detail-list--inline {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.detail-list--inline dt {
  font-size: 0.95rem;
  color: #4b5563;
}

.detail-list--inline dd {
  font-size: 1.1rem;
}

.handover-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
  gap: 1.1rem;
  align-items: flex-start;
}

.handover-layout--edge {
  grid-template-columns: minmax(0, 1fr);
}

.handover-layout--edge .handover-main {
  grid-column: 1;
  grid-row: 1;
  padding-right: 170px;
}

.h2h-editor-layout.handover-layout--edge .handover-main {
  padding-right: 0;
}

.handover-layout--edge .handover-history {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
}

.h2h-editor-layout {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  width: max-content;
  max-width: none;
}

.h2h-editor-layout .handover-main {
  flex: 0 0 auto;
  min-width: 0;
}

.h2h-editor-layout .h2h-history-sidebar {
  position: sticky;
  top: 1.25rem;
  flex: 0 0 150px;
}

.handover-main > * + * {
  margin-top: 1.5rem;
}

.handover-history {
  position: sticky;
  top: 1.25rem;
}

.history-panel {
  max-height: 70vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-list--incharge dt {
  text-transform: none;
}

.handover-meta {
  margin-top: 0.1rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.handover-meta span {
  font-weight: 600;
  text-transform: none;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-list--compact .history-entry {
  padding: 0.75rem 0.85rem;
}

.history-entry {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  background: #f9fafb;
  text-align: left;
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease;
}

.history-entry:hover {
  border-color: #94a3b8;
}

.history-entry.active {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
}

.history-entry__action {
  margin: 0;
  font-weight: 600;
}

.history-entry__time {
  font-size: 0.85rem;
  color: #6b7280;
}

.history-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.history-modal.open {
  display: flex;
}

.history-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.history-modal__dialog {
  position: relative;
  background: #ffffff;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
  width: min(760px, 90vw);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.history-modal__close {
  position: sticky;
  top: 0.75rem;
  align-self: flex-end;
  margin-left: auto;
  margin-bottom: -0.5rem;
  right: 0.75rem;
  z-index: 3;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
}

.history-modal__timestamp {
  font-size: 0.9rem;
  color: #6b7280;
}

.history-modal__body {
  background: transparent;
  color: #111827;
  padding: 0;
  border-radius: 0;
  white-space: pre-wrap;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.history-modal--detail .history-modal__dialog,
.history-modal__dialog.history-modal__dialog--detail {
  width: min(960px, 92vw);
  max-width: min(960px, 92vw) !important;
  max-height: 86vh;
}

.history-modal__dialog.history-modal__dialog--h2h {
  width: min(98vw, 1900px);
  max-width: 98vw !important;
  max-height: 92vh;
  padding: 1rem;
}

.history-modal__dialog--h2h .history-modal__body {
  overflow: visible;
}

.h2h-history-frame {
  overflow: visible;
}

.h2h-history-table-wrap {
  overflow: auto;
  max-height: calc(92vh - 8rem);
  border-radius: 0;
}

.h2h-table--history-original {
  min-width: 1900px;
}

.h2h-scoreboard--history {
  margin: 16px 0 0;
  max-width: none;
}

.h2h-history-input {
  background: #ffffff;
  color: #111827;
  cursor: default;
}

.h2h-table--history-original .h2h-meta-row__input,
.h2h-table--history-original .h2h-bet-meta__input,
.h2h-table--history-original .h2h-number,
.h2h-table--history-original .h2h-flag,
.h2h-table--history-original .h2h-text {
  pointer-events: none;
}

.h2h-table--history-original .h2h-meta-btn {
  opacity: 1;
}

.history-modal--detail .history-modal__body {
  white-space: normal;
  font-size: 0.85rem !important;
  line-height: 1.45 !important;
}

.history-modal--detail .history-modal__timestamp {
  font-size: 0.82rem !important;
}

.history-modal--detail .history-modal__title {
  font-size: 1rem !important;
  line-height: 1.25 !important;
}

.history-modal__dialog--draggable .history-modal__timestamp,
.history-modal__dialog--draggable .history-modal__title {
  cursor: move;
  user-select: none;
  touch-action: none;
}

.history-modal__dialog--draggable.is-dragging {
  cursor: move;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.32);
}

.history-snapshot {
  display: grid;
  gap: 0.85rem;
}

.history-snapshot--detail-page .history-detail-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.history-snapshot__notice {
  width: max-content;
  max-width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  color: #475569;
  background: #f8fafc;
  font-size: 0.75rem;
  font-weight: 600;
}

.history-snapshot__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem 0.8rem;
  margin: 0;
}

.history-snapshot__item {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.history-snapshot__item dt {
  margin: 0;
  color: #9ca3af;
  font-size: 0.72rem;
  font-weight: 600;
}

.history-snapshot__item dd {
  margin: 0;
  color: #111827;
  font-size: 0.85rem;
  word-break: break-word;
}

.history-snapshot__section {
  display: grid;
  gap: 0.35rem;
}

.history-snapshot__section h4 {
  margin: 0;
  color: #111827;
  font-size: 0.85rem;
  font-weight: 600;
}

.history-snapshot__body {
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: #ffffff;
  color: #111827;
  white-space: normal;
}

.history-snapshot__sections {
  display: grid;
  gap: 0.85rem;
}

.history-snapshot-section {
  display: grid;
  gap: 0.5rem;
}

.history-snapshot-section h4 {
  margin: 0;
  color: #111827;
  font-size: 0.88rem;
  font-weight: 700;
}

.history-snapshot-section__items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.history-snapshot-section__empty {
  border: 1px dashed #cbd5e1;
  border-radius: 0.6rem;
  padding: 0.65rem;
  color: #64748b;
  background: #f8fafc;
}

.history-snapshot-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 0.65rem;
  min-width: 0;
  border: 1px solid #e5e7eb;
  border-radius: 0.7rem;
  padding: 0.65rem;
  background: #ffffff;
}

.history-snapshot-card__media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border: 1px solid #e5e7eb;
  border-radius: 0.55rem;
  overflow: hidden;
  background: #f8fafc;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
}

.history-snapshot-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.history-snapshot-card__media--file span {
  max-width: 100%;
  padding: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-snapshot-card__content {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  align-content: start;
}

.history-snapshot-card__title {
  color: #111827;
  font-size: 0.86rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.history-snapshot-card__meta {
  color: #64748b;
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.history-snapshot-card__details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem 0.45rem;
  margin: 0.2rem 0 0;
}

.history-snapshot-card__details div {
  min-width: 0;
}

.history-snapshot-card__details dt {
  margin: 0;
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 600;
}

.history-snapshot-card__details dd {
  margin: 0;
  color: #111827;
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .history-snapshot__grid,
  .history-snapshot-section__items,
  .history-snapshot-card__details {
    grid-template-columns: 1fr;
  }

  .history-snapshot--detail-page .history-detail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-snapshot-card {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .history-snapshot-card__media {
    width: 56px;
    height: 56px;
  }
}

@media (max-width: 520px) {
  .history-snapshot--detail-page .history-detail-list {
    grid-template-columns: 1fr;
  }
}

.export-range {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.export-range__quick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem 0.75rem;
  font-size: 0.95rem;
}

.export-range__quick label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.export-range__custom {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.export-range__actions {
  margin-top: 0.75rem;
}

@media (max-width: 960px) {
  .handover-layout {
    grid-template-columns: 1fr;
  }

  .handover-history {
    position: static;
  }

  .handover-main > * + * {
    margin-top: 1.25rem;
  }
}

.entity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.announcement-list {
  gap: 0.6rem;
}

.announcement-section .section-header {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.announcement-section__titlebar {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.announcement-section__titlebar .btn-secondary {
  margin-top: 0 !important;
  top: auto !important;
  align-self: center;
}

.announcement-list--scroll {
  max-height: none;
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.25rem;
  scrollbar-gutter: stable;
}

.announcement-index {
  margin-right: 0.4rem;
  color: #6b7280;
  font-weight: 600;
}

.announcement-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: stretch;
}

.announcement-left {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 100%;
}

.announcement-calendar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: -2.1rem;
  height: 100%;
}

.calendar-card .calendar-header,
.calendar-note-list__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.calendar-card {
  margin-top: -0.35rem;
}

.calendar-header {
  margin-top: -0.25rem;
  align-items: center;
}

.calendar-header__left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calendar-header__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calendar-months {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.calendar-month__title {
  font-weight: 600;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  font-size: 0.55rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.calendar-weekdays span {
  text-align: center;
}

.calendar-grid {
  gap: 0.15rem;
}

.calendar-cell {
  border-radius: 0.4rem;
  background: #f9fafb;
  padding: 0.15rem;
  min-height: 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  border: 1px solid #e5e7eb;
  cursor: pointer;
}

.calendar-cell--muted {
  background: #f3f4f6;
  color: #9ca3af;
}

.calendar-cell--today {
  border-color: #3b82f6;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.35);
}

.calendar-cell--active {
  background: #e0e7ff;
  border-color: #4f46e5;
}

.calendar-cell--noted {
  background: #fff7ed;
  border-color: #fb923c;
}

.calendar-date {
  font-size: 0.6rem;
  font-weight: 600;
}

.calendar-note-dot {
  font-size: 0.55rem;
  background: #2563eb;
  color: #fff;
  border-radius: 999px;
  padding: 0 0.35rem;
  line-height: 1.3;
}

.calendar-note-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-note-modal[hidden] {
  display: none !important;
}

.calendar-note-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.calendar-note-modal__card {
  position: relative;
  background: #fff;
  border-radius: 0.75rem;
  padding: 1rem;
  width: min(360px, 90vw);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  z-index: 1;
}

.calendar-note-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.calendar-note-modal__body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.calendar-note-modal__item {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.5rem;
  background: #f9fafb;
}

.calendar-note-modal__by {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: #6b7280;
}
.calendar-note-list__items {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.calendar-note-actions {
  display: flex;
  justify-content: flex-end;
}

.calendar-note-list__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calendar-note-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.5rem;
}

.calendar-note-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.calendar-note-item__date {
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 600;
}

.announcement-item {
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background: #f9fafb;
  overflow: hidden;
  width: 100%;
}

.announcement-toggle {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.75rem 0.9rem;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.announcement-toggle:hover {
  background: #eef2ff;
}

.announcement-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.announcement-title {
  font-weight: 600;
  color: #111827;
}

.announcement-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  color: #6b7280;
  font-size: 0.56rem;
  justify-content: flex-end;
}

.announcement-meta__line {
  white-space: nowrap;
}

.announcement-content {
  border-top: 1px solid #e5e7eb;
  padding: 0.75rem 0.9rem;
  background: #ffffff;
}

.announcement-body {
  white-space: pre-wrap;
  font-size: 0.85rem;
  color: #374151;
}

.announcement-create {
  border-style: dashed;
}

.announcement-create textarea.form-control {
  height: auto;
  min-height: 120px;
}

.announcement-actions {
  margin-top: 0.6rem;
  display: flex;
  justify-content: flex-end;
}

.announcement-edit {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed #e5e7eb;
}

.announcement-past {
  padding: 1rem;
  width: 100%;
  display: block;
  box-sizing: border-box;
  margin-top: -0.4rem;
}

.announcement-past__summary {
  padding: 0;
  cursor: pointer;
  font-weight: 600;
  color: #374151;
  font-size: 0.85rem;
  margin-bottom: 0.45rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.announcement-past__summary::-webkit-details-marker {
  display: none;
}

.report-body {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 0.75rem;
  white-space: pre-wrap;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
}

.report-body--plain {
  background: transparent;
  color: #111827;
  padding: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  white-space: normal;
  font-size: 14px;
  line-height: 1.5;
}

.report-body--plain p {
  margin: 0 0 0.7rem 0;
}

.report-body--plain ul,
.report-body--plain ol {
  margin: 0.5rem 0 0.5rem 1.25rem;
  padding-left: 1rem;
}

.report-body--plain table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 12px;
}

.report-body--plain table th,
.report-body--plain table td {
  border: 1px solid #d1d5db;
  padding: 0.4rem 0.5rem;
  text-align: left;
}

.handover-editor {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.handover-editor__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  background: #f1f5f9;
  border: 1px solid #cbd5f5;
  border-radius: 0.65rem;
  padding: 0.4rem 0.5rem;
}

.handover-editor__toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.handover-editor__select {
  border: 1px solid #cbd5f5;
  border-radius: 0.5rem;
  padding: 0.15rem 0.35rem;
  font-size: 0.78rem;
  background: #fff;
  color: #1f2937;
  min-width: 70px;
  max-width: 110px;
}

.handover-editor__select--font {
  flex: 0 0 85px;
  max-width: 85px;
}

.handover-editor__select--size {
  flex: 0 0 50px;
  max-width: 50px;
}

.handover-editor__button {
  border: 1px solid #cbd5f5;
  border-radius: 0.5rem;
  padding: 0.2rem 0.4rem;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1f2937;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 28px;
}

.handover-editor__button:hover,
.handover-editor__button:focus-visible {
  border-color: #818cf8;
  color: #1d4ed8;
  outline: none;
}

.handover-editor__color-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.handover-editor__color-toggle {
  border: 1px solid #cbd5f5;
  border-radius: 0.5rem;
  padding: 0.2rem 0.5rem;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1f2937;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 28px;
}

.handover-editor__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.handover-editor__icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.handover-editor__color-panel {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  display: none;
  grid-template-columns: repeat(3, 32px);
  gap: 0.25rem;
  background: #fff;
  border: 1px solid #cbd5f5;
  border-radius: 0.5rem;
  padding: 0.35rem;
  box-shadow: 0 12px 25px rgba(15, 23, 42, 0.12);
  z-index: 25;
  min-width: 120px;
}

.handover-editor__color-picker.is-open .handover-editor__color-panel {
  display: grid;
}

.handover-editor__color-option {
  width: 32px;
  height: 28px;
  border: 1px solid #cbd5f5;
  border-radius: 0.35rem;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.handover-editor__color-option--text {
  display: flex;
  align-items: center;
  justify-content: center;
}

.handover-editor__color-option--block {
  width: 32px;
  padding: 0;
  display: inline-flex;
}

.handover-editor__color-option--clear {
  background: repeating-linear-gradient(45deg, #e2e8f0 0, #e2e8f0 6px, #fff 6px, #fff 12px);
}

.handover-editor__color-option:hover,
.handover-editor__color-option:focus-visible,
.handover-editor__color-toggle:hover,
.handover-editor__color-toggle:focus-visible {
  border-color: #818cf8;
  color: #1d4ed8;
  outline: none;
}

.handover-editor__surface {
  min-height: 360px;
  border: 1px solid #cbd5f5;
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: #fff;
  line-height: 1.5;
  font-family: inherit;
  font-size: 0.85rem;
  color: #111827;
  overflow-y: auto;
}

.handover-editor__surface:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.handover-editor__input {
  display: none !important;
}

.handover-editor-table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  display: inline-block;
  resize: both;
  overflow: auto;
}

.handover-editor-table td {
  border: 1px solid #d1d5db;
  padding: 0.35rem 0.5rem;
}

.handover-editor__surface table {
  max-width: 100%;
  display: inline-block;
  resize: both;
  overflow: auto;
}

textarea[data-rich-editor="handover"] {
  display: none !important;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 1rem;
}

.actions {
  display: flex;
  gap: 0.75rem;
}

.actions .action--right {
  margin-left: auto;
}

.actions > form {
  margin: 0;
  display: inline-flex;
}

.export-icons {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  color: #374151;
  background: #ffffff;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.btn-icon:hover {
  border-color: #cbd5f5;
  background: #f7f9ff;
}

.btn-icon--sm {
  padding: 0.2rem 0.35rem;
  font-size: 0.7rem;
}

.btn-icon--sm svg {
  width: 14px;
  height: 14px;
}

.section-header--simple {
  justify-content: flex-start;
}

.section-header--tight {
  margin-top: 0;
  margin-bottom: 0.1rem;
}

.compact-ui .filter-form {
  padding-top: 0.9rem;
  margin-top: 0;
}

.section-header--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.section-header__top,
.section-header__body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.section-header--stacked .section-header__body {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.section-header__actions {
  justify-content: flex-start;
}

.section-header__spacer {
  flex: 1;
}

.section-header__top {
  margin-top: 0;
  margin-bottom: 0;
}

.section-header--simple .actions {
  margin-left: 0;
}

.text-danger:empty {
  display: none;
}

@media (max-width: 640px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .announcement-grid {
    grid-template-columns: 1fr;
  }

  .calendar-months {
    grid-template-columns: 1fr;
  }
}


.status-banner {
  margin-bottom: 1.5rem;
  padding: 0.85rem 1.25rem;
  border-radius: 0.75rem;
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  font-weight: 600;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.handover-attachments {
  grid-column: 1 / -1;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.handover-attachments__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.handover-attachments__hint {
  margin: 0.3rem 0 0 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.handover-attachments__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.attachment-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 110px));
  gap: 0.2rem;
  justify-content: flex-start;
  margin-top: 0.15rem;
}

.photo-attachments .attachment-preview-grid {
  grid-template-columns: repeat(auto-fill, 110px);
  justify-content: center;
  width: 100%;
}

.photo-attachments .attachment-card {
  width: 110px;
  box-sizing: border-box;
}


.attachment-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.6rem;
  border-radius: 0.85rem;
  border: 1px dashed #cbd5f5;
  background: #fff;
  box-shadow: 0 5px 15px rgba(15, 23, 42, 0.04);
}


.attachment-card__actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.btn-chip {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #1f2937;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.btn-chip:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.linked-report-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.linked-report-card {
  border: 1px solid #d1d5db;
  border-radius: 0.65rem;
  padding: 0.3rem 0.55rem;
  background: #ffffff;
  box-shadow: none;
  flex: 0 1 auto;
  font-size: 0.67rem;
  line-height: 1.2;
}

.linked-report-card__header {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.linked-report-card__title {
  font-weight: 600;
  color: #111827;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  line-height: 1.2;
}

.linked-report-card__title:hover,
.linked-report-card__title:focus-visible {
  color: #1d4ed8;
}

.linked-report-card__title:focus-visible {
  outline: 2px solid #bfdbfe;
  outline-offset: 2px;
}

.linked-report-card__action {
  border: none;
  background: transparent;
  color: #2563eb;
  font-weight: 500;
  text-decoration: none;
  padding: 0;
  line-height: 1.2;
  white-space: nowrap;
}

.linked-report-card__action:hover {
  text-decoration: underline;
}

.linked-report-card__action:focus-visible {
  text-decoration: underline;
  outline: 2px solid #bfdbfe;
  outline-offset: 1px;
  border-radius: 0.35rem;
}

.linked-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2500;
}

.linked-modal.open {
  display: flex;
}

.linked-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.linked-modal__dialog {
  position: relative;
  background: #ffffff;
  border-radius: 1rem;
  padding: 1.5rem;
  width: min(600px, 90vw);
  box-shadow: 0 35px 80px rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 90vh;
  overflow-y: auto;
}

.linked-modal__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
}

.linked-modal__timestamp {
  color: #6b7280;
  font-size: 0.85rem;
}

.linked-modal__meta {
  color: #374151;
  font-weight: 600;
}

.linked-modal__body {
  background: #f9fafb;
  border-radius: 0.75rem;
  padding: 1rem;
  white-space: pre-wrap;
  color: #111827;
  min-height: 120px;
}

.attachment-card__preview {
  width: 60px;
  height: 60px;
  border-radius: 0.85rem;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.attachment-card__preview--file {
  border: 1px dashed #d1d5db;
}

.attachment-card__preview-link {
  display: block;
}

.attachment-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-preview-grid--contain .attachment-card__preview {
  background: #f3f4f6;
}

.attachment-preview-grid--contain .attachment-card__preview img {
  object-fit: contain;
}

.attachment-card__badge {
  font-weight: 700;
  font-size: 0.9rem;
  color: #1d4ed8;
}

.attachment-card__name {
  font-weight: 600;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.65rem;
}

.attachment-card__name--top {
  font-size: 0.7rem;
}

.attachment-card__subline {
  font-size: 0.6rem;
  color: #6b7280;
}

.handover-attachments .attachment-card__name {
  font-size: 0.65rem !important;
}

.handover-attachments .attachment-card__subline {
  font-size: 0.6rem !important;
}

.photo-attachments .attachment-card__preview {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 0.85rem;
}

.photo-attachments .attachment-card__preview a {
  display: block;
  width: 100%;
  height: 100%;
}

.photo-attachments .attachment-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: contain !important;
  display: block;
}

.attachment-card__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.attachment-card__primary {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  color: #475569;
}

.attachment-card__remove {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 3;
}

.attachment-card__remove:hover {
  color: #ef4444;
}

.attachment-card__controls .attachment-card__remove {
  position: static;
  top: auto;
  right: auto;
  font-size: 1rem;
}

.attachment-card--image .attachment-card__preview {
  border: none;
  padding: 0;
}

.attachment-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 1.25rem;
  border: 1px dashed #cbd5f5;
  border-radius: 0.85rem;
  color: #6b7280;
  background: rgba(59, 130, 246, 0.05);
}

.handover-hidden-inputs {
  display: none;
}

.handover-link-summary {
  grid-column: 1 / -1;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.25rem 0.45rem;
  background: #fafbff;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.handover-link-summary__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.handover-link-summary__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.handover-link-summary__empty {
  padding: 0.2rem 0.4rem;
  border: 1px dashed #c7d2fe;
  border-radius: 0.75rem;
  color: #5b21b6;
  font-size: 0.75rem;
}

.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.45rem;
  border-radius: 0.65rem;
  background: #eef2ff;
  color: #312e81;
  font-size: 0.72rem;
  border: 1px solid #c7d2fe;
  min-width: 0;
}

.link-chip__title {
  font-weight: 600;
  font-size: 0.75rem;
  color: #312e81;
  text-align: left;
  cursor: pointer;
  line-height: 1.1;
}

.link-chip__title:focus-visible {
  outline: 2px solid #a5b4fc;
  outline-offset: 1px;
}

.link-chip__remove {
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
}

.link-chip__remove:hover {
  color: #ef4444;
}

.handover-link-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2100;
}

.handover-link-modal.open {
  display: flex;
}

.handover-link-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
}

.handover-link-modal__dialog {
  position: relative;
  background: #ffffff;
  border-radius: 1rem;
  width: min(720px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  box-shadow: 0 35px 80px rgba(15, 23, 42, 0.45);
  overflow: hidden;
}

.handover-link-modal__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.handover-link-modal__header h3 {
  margin: 0;
}

.handover-link-modal__header p {
  margin: 0.25rem 0 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.handover-link-modal__close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
}

.handover-link-modal__search {
  position: relative;
}

.handover-link-modal__list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-right: 0.25rem;
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.85rem;
  padding: 0.75rem 1rem;
  background: #f9fafb;
}

.link-row__info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.link-row__title {
  font-weight: 600;
  color: #111827;
}

.link-row__meta {
  color: #6b7280;
  font-size: 0.85rem;
}

.screenshot-overlay[hidden] {
  display: none;
}

.screenshot-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 2000;
}

.screenshot-overlay img {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(100%, 100vw);
  height: min(100%, 100vh);
  object-fit: contain;
  border-radius: 0.85rem;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.4);
  user-select: none;
  pointer-events: auto;
  display: none;
}

.screenshot-overlay img[data-ready="true"] {
  display: block;
  cursor: crosshair;
}

.screenshot-overlay__selection {
  position: fixed;
  border: 2px dashed #3b82f6;
  background: rgba(59, 130, 246, 0.15);
  pointer-events: none;
}

.screenshot-overlay__toolbar {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1rem;
  background: rgba(15, 23, 42, 0.85);
  color: #f3f4f6;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.screenshot-overlay__note {
  font-size: 0.9rem;
  white-space: nowrap;
}

body.screenshot-overlay-open {
  overflow: hidden;
}

.handover-link-modal-open {
  overflow: hidden;
}

.form-group--compact {
  min-width: 0;
  margin-bottom: 0;
}

.form-group--compact .form-control {
  min-width: 0;
}

.handover-title-display {
  width: min(26ch, 100%);
  min-width: 20ch;
  padding: 0.4rem 0.65rem;
  font-size: 0.85rem;
  line-height: 1.3;
}

.handover-date-display {
  width: min(18ch, 100%);
  min-width: 14ch;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
}

.handover-shift-select {
  width: min(9ch, 100%);
  min-width: 7ch;
  padding: 0.4rem 0.55rem;
  font-size: 0.85rem;
}

.report-form--compact input.form-control,
.report-form--compact select.form-control {
  height: 34.52px;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  font-size: 0.85rem;
}

.report-form--compact .handover-title-display,
.report-form--compact .handover-date-display,
.report-form--compact .handover-shift-select {
  height: 34.52px;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  font-size: 0.85rem;
}

.handover-title-group,
.handover-date-group,
.handover-shift-group {
  margin-right: 0;
}

.handover-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.handover-meta .form-group {
  margin-bottom: 0;
}

.handover-meta--inline {
  width: 100%;
}

@media (min-width: 768px) {
  .handover-meta--inline {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(160px, auto) minmax(120px, auto);
    gap: 0.75rem;
    align-items: end;
  }

  .handover-meta--inline .handover-title-display,
  .handover-meta--inline .handover-date-display,
  .handover-meta--inline .handover-shift-select {
    width: 100%;
    min-width: 0;
  }

  .handover-meta--inline .handover-title-group {
    width: 100%;
    margin-right: 0;
  }

  .handover-meta--inline .handover-date-group,
  .handover-meta--inline .handover-shift-group {
    margin-right: 0;
  }
}

.form-group--body textarea {
  min-height: 320px;
}

.form-hint {
  margin-top: 0.15rem;
  font-size: 0.7rem;
  color: #9ca3af;
}

.handover-link-modal-open {
  overflow: hidden;
}
.form-group--compact {
  min-width: 0;
}

.form-group--compact .form-control {
  min-width: 0;
}
.form-group--body textarea {
  min-height: 320px;
}

.form-section__title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px 16px;
}

.checkbox-item,
.radio-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #1f2937;
}

.period-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
    gap: 16px;
}

.period-grid__quick,
.period-grid__custom {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.period-grid__custom .filter-date-field {
    width: 220px;
    max-width: 220px;
}

.period-grid__custom .date-input--compact {
    max-width: 100%;
}

.period-grid__custom .analytics-datetime-field {
    width: 180px;
    max-width: 180px;
}

.period-grid__custom .analytics-datetime-field .incident-datetime-input {
    width: 180px;
    max-width: 180px;
    min-width: 180px;
}

.radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.date-input--compact {
    max-width: 220px;
}

.dropdown-order-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.dropdown-order-item {
    display: grid;
    grid-template-columns: 1fr 90px 90px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
}

.dropdown-order-actions {
    display: flex;
    gap: 0.35rem;
    justify-self: end;
}

.dropdown-admin-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.dropdown-admin-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dropdown-order-input {
    width: 70px;
}

.dropdown-order-add {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.dropdown-order-add .form-control {
    min-width: 0;
}

.dropdown-admin-card {
    width: 100%;
    min-width: 240px;
}

.admin-handover-card {
    max-width: 920px;
}

.dropdown-admin-form {
    width: 100%;
}

.administration-page {
  font-family: inherit;
  font-size: 0.85rem;
  gap: 0.75rem;
}

.administration-page .section-header h1 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.administration-page .card {
  padding: 1rem;
}

.administration-page .card-header {
  gap: 0.2rem;
}

.administration-page .card-header h2,
.administration-page .card h2,
.administration-page h3 {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
}

.administration-page .muted,
.administration-page p,
.administration-page li {
  font-size: 0.8rem;
  line-height: 1.35;
}

.administration-page .form-label {
  font-size: 0.7rem;
}

.administration-page .form-control,
.administration-page select,
.administration-page textarea {
  font-family: inherit;
  font-size: 0.85rem;
}

.administration-page .btn-primary,
.administration-page .btn-secondary,
.administration-page .btn-tertiary {
  font-size: 0.78rem;
  padding: 0.5rem 0.8rem;
  line-height: 1;
}

.administration-page .btn-xs {
  font-size: 0.7rem;
  padding: 0.3rem 0.55rem;
}

.administration-page .data-table {
  font-size: 0.82rem;
}

.administration-page .data-table th,
.administration-page .data-table td {
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  line-height: 1.25;
}

.administration-page .dropdown-order-item {
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.25;
}

.administration-page .dropdown-order-input {
  height: 28px;
  font-size: 0.82rem;
}

.administration-page .report-template-guide {
  font-size: 0.8rem;
}

.admin-session-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.admin-session-panel {
  display: grid;
  gap: 0.65rem;
  align-content: start;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  padding: 0.8rem;
  background: rgba(148, 163, 184, 0.08);
}

.admin-session-panel h3 {
  margin: 0 0 0.25rem;
}

.admin-session-control-row {
  display: grid;
  gap: 0.35rem;
}

.admin-session-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-session-input-group .form-control {
  max-width: 120px;
}

.admin-session-panel--danger {
  border-color: rgba(192, 57, 43, 0.35);
}

.administration-page code,
.administration-page pre {
  font-size: 0.78rem;
}

.administration-page .admin-nav {
  gap: 0.35rem !important;
}

/* Final H2H print overrides (A3) */
@media print {
  @page {
    size: A3 landscape;
    margin: 6mm;
  }

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    height: auto !important;
  }

  body {
    background: #fff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .container,
  .container-fluid,
  .container-sm,
  .container-md,
  .container-lg,
  .container-xl,
  .container-xxl {
    max-width: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .app-content,
  .page-container,
  .h2h-page,
  .h2h-print {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #h2hPrintRoot {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .h2h-print-block {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    transform: none !important;
  }

  .h2h-page,
  .h2h-wrapper,
  .h2h-frame,
  .h2h-card,
  .h2h-card-body,
  .h2h-table-wrap,
  .h2h-table-container {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .sticky,
  .sticky-top,
  .sticky-col,
  thead.sticky,
  .h2h-sticky {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
  }

  .h2h-table {
    width: 100% !important;
    table-layout: auto !important;
    margin: 0 !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
  }

  .h2h-table th,
  .h2h-table td {
    border: 1px solid #d1d5db !important;
  }

  .h2h-border-left,
  .h2h-col-a {
    border-left: 1px solid #d1d5db !important;
  }

  .h2h-border-right,
  .h2h-col-b-right,
  .h2h-col-last {
    border-right: 1px solid #d1d5db !important;
  }

  .h2h-border-right-double {
    border-right: 1px solid #d1d5db !important;
  }

  .h2h-border-right-double-gray {
    border-right: 1px solid #d1d5db !important;
  }

  .h2h-bet-left-black,
  .h2h-bet-right-black,
  .h2h-bet-top-black,
  .h2h-bet-left-span,
  .h2h-types-bottom {
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #d1d5db !important;
  }

  .h2h-table tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .h2h-table thead {
    display: table-row-group !important;
  }

  .h2h-table tfoot {
    display: table-footer-group !important;
  }

  .h2h-summary-strip {
    width: var(--h2h-summary-table-width, 100%) !important;
    display: grid !important;
    grid-template-columns:
      var(--h2h-summary-left, 0px)
      var(--h2h-bet-width)
      var(--h2h-result-width)
      var(--h2h-calc-width) !important;
    column-gap: 0 !important;
    align-items: start !important;
  }

  .h2h-summary-strip .h2h-summary__spacer {
    display: block !important;
  }

.h2h-summary-strip .h2h-summary-bet {
  grid-column: 2 !important;
  margin-left: -1.1rem !important;
}

.h2h-summary-strip .h2h-summary-results {
  grid-column: 3 !important;
  margin-left: 0 !important;
}

.h2h-summary-strip .h2h-summary-calculated {
  grid-column: 4 !important;
  margin-left: 1.1rem !important;
}

  .h2h-summary-items {
    display: grid !important;
    grid-template-columns: repeat(4, max-content) !important;
    gap: 4px 28px !important;
  }

  .h2h-summary-item {
    white-space: nowrap !important;
  }

  .h2h-meta-row__item.field-date,
  .h2h-meta-row__item.field-dealer {
    margin-left: -0.72rem !important;
    margin-right: 0.72rem !important;
  }

  .h2h-meta-row__inline--toggle {
    margin-left: 0.32rem !important;
  }

  .h2h-header--results {
    font-size: 0.54rem !important;
  }

  .h2h-calc-cell {
    font-size: 0.68rem !important;
    line-height: 1.1 !important;
  }

  .h2h-bet-meta__controls,
  button[data-patron-add],
  button[data-patron-remove] {
    display: none !important;
  }

  .h2h-scoreboard,
  .h2h-scoreboard * {
    transform: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .h2h-scoreboard {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    overflow: visible !important;
    display: block !important;
    box-sizing: border-box !important;
    padding: 10px 12px !important;
    border: 1px solid #d0d7e2 !important;
    border-radius: 10px !important;
    background: #fff !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .h2h-board {
    overflow: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    border-color: #aeb8c7 !important;
    background-color: #f8fafc !important;
  }

  .h2h-board::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
  }

  .h2h-board--bigroad,
  .h2h-board--bead {
    background-image:
      linear-gradient(to right, #c4cedd 1px, transparent 1px),
      linear-gradient(to bottom, #c4cedd 1px, transparent 1px) !important;
  }

  .h2h-board--eye,
  .h2h-board--small,
  .h2h-board--cockroach {
    background-image:
      linear-gradient(to right, #c4cedd 1px, transparent 1px),
      linear-gradient(to bottom, #c4cedd 1px, transparent 1px) !important;
  }

  .h2h-board__cell {
    border-right-color: #b8c3d3 !important;
    border-bottom-color: #b8c3d3 !important;
  }

  .h2h-scoreboard__header {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    margin: 0 0 8px 0 !important;
    break-after: avoid !important;
    page-break-after: avoid !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .h2h-scoreboard__stack {
    width: 100% !important;
    max-width: none !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}

.card-counting-page {
  gap: 0.9rem;
}

.cc-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.cc-filter-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.cc-session-table th:last-child,
.cc-session-table td:last-child {
  width: 90px;
  text-align: right;
}

.cc-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.cc-form-span-2 {
  grid-column: span 2;
}

.cc-form-actions {
  align-items: center;
}

.cc-session-top-grid {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.cc-session-title-block h2 {
  margin: 0;
}

.cc-session-rule-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  font-size: 0.8rem;
  color: #374151;
}

.cc-metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.cc-stat-value {
  font-size: 1.35rem;
}

.cc-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.cc-entry-stack {
  display: grid;
  gap: 0.75rem;
}

.cc-entry-stack .card {
  margin: 0;
}

.cc-entry-grid .card {
  margin: 0;
}

.cc-entry-grid h3 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
}

.cc-entry-form-grid {
  gap: 0.6rem;
}

.cc-rank-field {
  grid-column: 1 / -1;
}

.cc-quick-card {
  position: relative;
}

.cc-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
}

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

.cc-quick-auto-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cc-inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: #334155;
}

.cc-quick-mini-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.cc-input-tiny {
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  text-align: center;
  font-weight: 700;
  text-transform: uppercase;
  padding-left: 0;
  padding-right: 0;
}

.cc-hand-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.35rem;
  align-items: center;
}

.cc-step-btn {
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #ffffff;
  color: #334155;
  font-weight: 700;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.cc-step-btn:hover {
  border-color: #60a5fa;
  color: #1d4ed8;
}

.cc-quick-pad {
  margin-top: 0.55rem;
}

.cc-quick-pad__label {
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  color: #475569;
  font-weight: 600;
}

.cc-seat-buttons {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.35rem;
}

.cc-seat-btn {
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #ffffff;
  color: #334155;
  padding: 0.4rem 0;
  font-weight: 700;
  cursor: pointer;
}

.cc-seat-btn:hover {
  border-color: #60a5fa;
  color: #1d4ed8;
}

.cc-seat-btn.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.cc-rank-buttons {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
}

.cc-rank-buttons--quick {
  grid-template-columns: repeat(10, minmax(0, 1fr));
}

.cc-rank-btn {
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  background: #ffffff;
  color: #334155;
  padding: 0.35rem 0;
  font-weight: 600;
  cursor: pointer;
}

.cc-rank-btn:hover {
  border-color: #60a5fa;
  color: #1d4ed8;
}

.cc-rank-btn.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.cc-rank-btn:disabled,
.cc-seat-btn:disabled,
.cc-step-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cc-quick-sequence {
  margin-top: 0.55rem;
}

.cc-quick-sequence__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.cc-quick-hint {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.cc-quick-status {
  min-height: 1rem;
  margin-top: 0.25rem;
}

.cc-quick-card.is-busy {
  opacity: 0.86;
}

.cc-board-card {
  padding: 0.75rem;
}

.cc-board-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.cc-board-status {
  min-height: 1rem;
  font-size: 0.8rem;
}

.cc-board-wrap {
  padding: 0.35rem;
}

.cc-board-table {
  min-width: 1760px;
}

.cc-board-table thead tr:nth-child(1) th {
  top: 0;
  height: 34px;
  z-index: 5;
}

.cc-board-table thead tr:nth-child(2) th {
  top: 34px;
  height: 36px;
  z-index: 4;
}

.cc-board-table thead tr:nth-child(3) th {
  top: 70px;
  height: 28px;
  z-index: 3;
  font-size: 0.66rem;
  color: #64748b;
}

.cc-board-table .sticky-col {
  min-width: 52px;
}

.cc-board-col-head {
  font-size: 0.72rem;
}

.cc-board-subhead th {
  font-weight: 500;
}

.cc-board-subhead__sticky {
  background: #f8fafc !important;
}

.cc-board-hand {
  width: 44px;
  min-width: 44px;
  background: #f8fafc;
  font-weight: 700;
}

.cc-board-rank,
.cc-board-seat,
.cc-board-marker {
  width: 32px;
  min-width: 32px;
}

.cc-board-seq {
  width: 92px;
  min-width: 92px;
}

.cc-board-bet {
  width: 70px;
  min-width: 70px;
}

.cc-board-row--filled .h2h-coup-cell {
  background: #eef6ff;
}

.cc-board-footnote {
  text-align: left;
  font-size: 0.72rem;
  color: #475569;
  padding: 0.35rem 0.5rem !important;
}

.cc-manual-card {
  padding: 0;
  overflow: hidden;
}

.cc-manual-card summary {
  list-style: none;
  cursor: pointer;
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: #1e293b;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.cc-manual-card summary::-webkit-details-marker {
  display: none;
}

.cc-manual-card__body {
  padding: 0.85rem;
}

.cc-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.cc-summary-grid h3 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
}

.cc-summary-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.cc-summary-list dt {
  font-size: 0.72rem;
}

.cc-summary-list dd {
  font-size: 0.9rem;
}

.cc-timeline-table,
.cc-event-table {
  font-size: 0.8rem;
}

.cc-timeline-table th,
.cc-timeline-table td,
.cc-event-table th,
.cc-event-table td {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

@media (max-width: 1200px) {
  .cc-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cc-entry-grid,
  .cc-summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .cc-filter-grid,
  .cc-form-grid,
  .cc-summary-list {
    grid-template-columns: 1fr;
  }

  .cc-quick-grid {
    grid-template-columns: 1fr;
  }

  .cc-seat-buttons {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .cc-form-span-2 {
    grid-column: span 1;
  }

  .cc-rank-buttons {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .cc-filter-actions {
    justify-content: flex-start;
  }

  .cc-board-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Final dark-mode normalization. Keep this late so it wins over module-specific light styles. */
body.theme-dark {
  color-scheme: dark;
  background: #0f172a;
  color: #e2e8f0;
}

body.theme-dark .page-container,
body.theme-dark .app-main,
body.theme-dark .app-content,
body.theme-dark .card-counting-page {
  background: #0f172a;
  color: #e2e8f0;
}

body.theme-dark .app-header,
body.theme-dark .top-tabs,
body.theme-dark .app-footer {
  background: #0b1220;
  border-color: #1e293b;
}

body.theme-dark .card,
body.theme-dark .table-card,
body.theme-dark .form-card--narrow,
body.theme-dark .person-card,
body.theme-dark .profile-detail-card,
body.theme-dark .profile-related-card,
body.theme-dark .handover-attachments,
body.theme-dark .handover-link-summary,
body.theme-dark .linked-report-card,
body.theme-dark .attachment-card,
body.theme-dark .dropdown-admin-card,
body.theme-dark .dropdown-admin-block,
body.theme-dark .dropdown-order-item,
body.theme-dark .report-template-guide,
body.theme-dark .calendar-card,
body.theme-dark .calendar-note-modal__card,
body.theme-dark .people-modal__dialog,
body.theme-dark .person-panel,
body.theme-dark .history-modal__dialog,
body.theme-dark .linked-modal__dialog,
body.theme-dark .date-time-panel,
body.theme-dark .cc-manual-card,
body.theme-dark .cc-manual-card summary,
body.theme-dark .cc-manual-card__body {
  background: #0b1220;
  color: #e2e8f0;
  border-color: #1e293b;
  box-shadow: none;
}

body.theme-dark .card h1,
body.theme-dark .card h2,
body.theme-dark .card h3,
body.theme-dark .section-header h1,
body.theme-dark .detail-section__title,
body.theme-dark .profile-title,
body.theme-dark .people-modal__title,
body.theme-dark .person-panel__title,
body.theme-dark .cc-entry-grid h3,
body.theme-dark .cc-summary-grid h3 {
  color: #f8fafc;
}

body.theme-dark .muted,
body.theme-dark .form-label,
body.theme-dark .detail-list dt,
body.theme-dark .profile-detail-card .muted,
body.theme-dark .person-card__detail span:first-child,
body.theme-dark .person-card__meta,
body.theme-dark .attachment-card__subline,
body.theme-dark .report-snippet,
body.theme-dark .cc-quick-hint,
body.theme-dark .cc-board-footnote,
body.theme-dark .form-hint {
  color: #94a3b8;
}

body.theme-dark .profile-detail-card .muted + div,
body.theme-dark .profile-detail-card [style*="white-space: pre-wrap"],
body.theme-dark .person-card__detail,
body.theme-dark .person-card__detail span:last-child,
body.theme-dark .detail-list dd,
body.theme-dark .report-body--plain,
body.theme-dark .report-body--plain p,
body.theme-dark .history-modal__body,
body.theme-dark .linked-modal__body {
  color: #e2e8f0;
}

body.theme-dark .data-table,
body.theme-dark .roster-table,
body.theme-dark .h2h-table,
body.theme-dark .cc-board-table {
  background: #0b1220;
  color: #e2e8f0;
  border-color: #1e293b;
}

body.theme-dark .data-table thead,
body.theme-dark .data-table th,
body.theme-dark .roster-header-day,
body.theme-dark .roster-header-weekday,
body.theme-dark .roster-group-row th,
body.theme-dark .cc-board-table thead th,
body.theme-dark .cc-board-subhead__sticky,
body.theme-dark .cc-board-hand,
body.theme-dark .h2h-table thead th,
body.theme-dark .h2h-row-head,
body.theme-dark .h2h-row-num,
body.theme-dark .h2h-head-spacer {
  background: #111827 !important;
  color: #f8fafc;
  border-color: #1e293b !important;
}

body.theme-dark .data-table td,
body.theme-dark .data-table th,
body.theme-dark .roster-table td,
body.theme-dark .roster-table th,
body.theme-dark .h2h-table td,
body.theme-dark .h2h-table th,
body.theme-dark .cc-board-table td,
body.theme-dark .cc-board-table th {
  border-color: #1e293b !important;
}

body.theme-dark .data-table tbody tr:hover,
body.theme-dark .cc-board-row--filled .h2h-coup-cell {
  background: rgba(96, 165, 250, 0.12);
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea,
body.theme-dark .form-control,
body.theme-dark .date-time-panel__date,
body.theme-dark .date-time-panel__time-input,
body.theme-dark .roster-select,
body.theme-dark .roster-input,
body.theme-dark .h2h-number,
body.theme-dark .h2h-flag,
body.theme-dark .h2h-text,
body.theme-dark .h2h-meta-row__input,
body.theme-dark .h2h-bet-meta__input {
  background: #111827;
  color: #e2e8f0;
  border-color: #334155;
}

body.theme-dark input:disabled,
body.theme-dark select:disabled,
body.theme-dark textarea:disabled,
body.theme-dark input[readonly],
body.theme-dark .form-control[readonly],
body.theme-dark .h2h-input--readonly {
  background: #0f172a;
  color: #cbd5e1;
  border-color: #334155;
}

body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder,
body.theme-dark .form-control::placeholder {
  color: #64748b;
}

body.theme-dark input:focus,
body.theme-dark select:focus,
body.theme-dark textarea:focus,
body.theme-dark .form-control:focus {
  border-color: #60a5fa;
  outline-color: rgba(96, 165, 250, 0.22);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.18);
}

body.theme-dark .btn-tertiary,
body.theme-dark .theme-toggle,
body.theme-dark .cc-step-btn,
body.theme-dark .cc-seat-btn,
body.theme-dark .cc-rank-btn,
body.theme-dark .date-time-panel__button {
  background: #111827;
  color: #e2e8f0;
  border-color: #334155;
}

body.theme-dark .btn-tertiary:hover,
body.theme-dark .cc-step-btn:hover,
body.theme-dark .cc-seat-btn:hover,
body.theme-dark .cc-rank-btn:hover,
body.theme-dark .date-time-panel__button:hover {
  background: #1e293b;
  border-color: #475569;
  color: #f8fafc;
}

body.theme-dark .btn-primary,
body.theme-dark .date-time-panel__button--apply {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  box-shadow: none;
}

body.theme-dark .btn-secondary {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

body.theme-dark a,
body.theme-dark .link,
body.theme-dark .cell-title a,
body.theme-dark .linked-report-card__title,
body.theme-dark .linked-report-card__action {
  color: #93c5fd;
}

body.theme-dark a:hover,
body.theme-dark .link:hover,
body.theme-dark .cell-title a:hover,
body.theme-dark .linked-report-card__title:hover,
body.theme-dark .linked-report-card__action:hover {
  color: #bfdbfe;
}

body.theme-dark .attachment-empty,
body.theme-dark .attachment-card__preview,
body.theme-dark .attachment-card__preview--file,
body.theme-dark .photo-attachments .attachment-card__preview,
body.theme-dark .profile-detail-chip,
body.theme-dark .person-card__chip,
body.theme-dark .patron-avatar,
body.theme-dark .patron-avatar__placeholder,
body.theme-dark .person-card__avatar,
body.theme-dark .person-item__avatar,
body.theme-dark .cc-seat-btn.is-active,
body.theme-dark .cc-rank-btn.is-active {
  background: #111827;
  color: #e2e8f0;
  border-color: #334155;
}

body.theme-dark .attachment-empty {
  border-color: #334155;
}

body.theme-dark .status-banner,
body.theme-dark .table-pagination,
body.theme-dark .pager-page.is-active,
body.theme-dark .calendar-note,
body.theme-dark .announcement-edit,
body.theme-dark .announcement-past__summary,
body.theme-dark .report-body,
body.theme-dark .linked-modal__body {
  background: #111827;
  color: #e2e8f0;
  border-color: #1e293b;
}

body.theme-dark .report-body--plain table th,
body.theme-dark .report-body--plain table td,
body.theme-dark .report-body--plain table {
  border-color: #334155;
}

body.theme-dark .employee-row--terminated,
body.theme-dark .employee-card--terminated,
body.theme-dark .person-card--terminated {
  background: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
}

body.theme-dark .patron-row--banned,
body.theme-dark .patron-card--banned,
body.theme-dark .person-card--banned {
  background: rgba(239, 68, 68, 0.16);
  color: #fee2e2;
}

body.theme-dark .patron-ban-flag,
body.theme-dark .person-card__flag--ban {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.14);
}

body.theme-dark .terminated-flag,
body.theme-dark .person-card__flag--terminated {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.16);
}

body.theme-dark .date-picker-popover,
body.theme-dark .date-picker-calendar,
body.theme-dark .date-time-panel {
  background: #0b1220;
  color: #e2e8f0;
  border-color: #334155;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

body.theme-dark .date-picker-calendar button,
body.theme-dark .date-picker-day,
body.theme-dark .date-picker-nav {
  color: #e2e8f0;
}

body.theme-dark .date-picker-day:hover,
body.theme-dark .date-picker-nav:hover {
  background: #1e293b;
}

body.theme-dark .date-picker-day.is-selected,
body.theme-dark .date-picker-day[aria-selected="true"] {
  background: #2563eb;
  color: #ffffff;
}

body.theme-dark .handover-editor__surface {
  background: #111827;
  color: #e2e8f0;
  border-color: #334155;
}

body.theme-dark .handover-editor__toolbar,
body.theme-dark .handover-editor__select,
body.theme-dark .handover-editor__button,
body.theme-dark .handover-editor__color-panel,
body.theme-dark .handover-editor__color-option {
  background: #0b1220;
  color: #e2e8f0;
  border-color: #334155;
}

body.theme-dark .top-tab__subtext,
body.theme-dark .workspace-switch-label {
  color: #94a3b8;
}

body.theme-dark .filter-form,
body.theme-dark form.filter-grid,
body.theme-dark .report-charts,
body.theme-dark .report-chart,
body.theme-dark .report-chart__canvas,
body.theme-dark .announcement-create,
body.theme-dark .announcement-past,
body.theme-dark .announcement-item,
body.theme-dark .announcement-content,
body.theme-dark .calendar-note-card,
body.theme-dark .calendar-cell,
body.theme-dark .calendar-note-modal__item {
  background: #111827;
  color: #e2e8f0;
  border-color: #1e293b;
  box-shadow: none;
}

body.theme-dark .filter-form {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.24);
}

body.theme-dark .announcement-title,
body.theme-dark .announcement-body,
body.theme-dark .announcement-toggle,
body.theme-dark .calendar-month__title,
body.theme-dark .calendar-date,
body.theme-dark .calendar-note-modal__content,
body.theme-dark .calendar-note-item__content,
body.theme-dark .report-chart__header h3,
body.theme-dark .form-section__title,
body.theme-dark .checkbox-item,
body.theme-dark .checkbox-item span,
body.theme-dark .radio-item,
body.theme-dark .radio-item span,
body.theme-dark .legend-row {
  color: #e2e8f0;
}

body.theme-dark .announcement-meta,
body.theme-dark .announcement-past__summary,
body.theme-dark .calendar-weekdays,
body.theme-dark .calendar-note-modal__by,
body.theme-dark .calendar-note-item__date,
body.theme-dark .report-chart__empty {
  color: #94a3b8;
}

body.theme-dark .announcement-toggle:hover,
body.theme-dark .calendar-cell:hover {
  background: #1e293b;
}

body.theme-dark .announcement-content,
body.theme-dark .announcement-edit,
body.theme-dark .calendar-note-item {
  border-color: #334155;
}

body.theme-dark .calendar-cell--muted {
  background: #0b1220;
  color: #64748b;
  border-color: #1e293b;
}

body.theme-dark .calendar-cell--today {
  border-color: #60a5fa;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.45);
}

body.theme-dark .calendar-cell--active {
  background: rgba(37, 99, 235, 0.28);
  border-color: #60a5fa;
}

body.theme-dark .calendar-cell--noted {
  background: rgba(251, 146, 60, 0.16);
  border-color: #fb923c;
}

body.theme-dark .calendar-note-modal__backdrop {
  background: rgba(2, 6, 23, 0.72);
}

body.theme-dark .date-calendar-popover {
  background: #0b1220;
  color: #e2e8f0;
  border-color: #334155;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

body.theme-dark .date-calendar-popover__nav,
body.theme-dark .date-calendar-popover__day {
  background: #111827;
  color: #e2e8f0;
}

body.theme-dark .date-calendar-popover__nav:hover,
body.theme-dark .date-calendar-popover__day:hover {
  background: #1e293b;
}

body.theme-dark .date-calendar-popover__day.is-muted {
  background: #0f172a;
  color: #64748b;
}

body.theme-dark .date-calendar-popover__day.is-today {
  background: rgba(37, 99, 235, 0.22);
  border-color: #60a5fa;
}

body.theme-dark .date-calendar-popover__day.is-selected,
body.theme-dark .date-calendar-popover__day[aria-selected="true"] {
  background: #2563eb;
  color: #ffffff;
}

body.theme-dark .date-calendar-popover__weekdays {
  color: #94a3b8;
}

body.theme-dark .top-tab.active,
body.theme-dark .top-tab.active .top-tab__label,
body.theme-dark .top-tab.active .top-tab__subtext {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

body.theme-dark .btn-icon,
body.theme-dark .btn-icon svg,
body.theme-dark .btn-icon span {
  background: #111827;
  color: #e2e8f0;
  border-color: #334155;
}

body.theme-dark .btn-icon:hover {
  background: #1e293b;
  color: #f8fafc;
  border-color: #475569;
}

body.theme-dark .h2h-frame,
body.theme-dark .h2h-table-wrap,
body.theme-dark .h2h-summary,
body.theme-dark .h2h-scoreboard {
  background: #0b1220;
  color: #e2e8f0;
  border-color: #1e293b;
  box-shadow: none;
}

body.theme-dark .h2h-scoreboard {
  --board-bg: #0f172a;
  --board-border: #334155;
}

body.theme-dark .h2h-board {
  background-color: #0f172a;
  border-color: #334155;
}

body.theme-dark .h2h-board__cell {
  border-color: #334155;
}

body.theme-dark .h2h-scoreboard__title,
body.theme-dark .h2h-scoreboard__toggle,
body.theme-dark .h2h-scoreboard__toggle label,
body.theme-dark .h2h-board__label,
body.theme-dark .h2h-summary__title,
body.theme-dark .h2h-summary__row,
body.theme-dark .h2h-summary__total {
  color: #e2e8f0;
}

body.theme-dark .history-snapshot__notice,
body.theme-dark .history-snapshot__body,
body.theme-dark .history-snapshot-section__empty,
body.theme-dark .history-snapshot-card,
body.theme-dark .history-snapshot-card__media {
  background: #111827;
  color: #e2e8f0;
  border-color: #334155;
}

body.theme-dark .history-snapshot__item dt,
body.theme-dark .history-snapshot-card__meta,
body.theme-dark .history-snapshot-card__details dt {
  color: #94a3b8;
}

body.theme-dark .history-snapshot__item dd,
body.theme-dark .history-snapshot__section h4,
body.theme-dark .history-snapshot-section h4,
body.theme-dark .history-snapshot-card__title,
body.theme-dark .history-snapshot-card__details dd {
  color: #e2e8f0;
}
