/*
 * Modern compatibility layer.
 *
 * This file intentionally changes presentation only. Legacy body markup,
 * route contracts, form fields, and JavaScript hooks remain untouched.
 */
:root {
  --color-primary: #1068b2;
  --color-primary-strong: #0d5a98;
  --color-primary-soft: #eaf4fc;
  --color-accent: #50b748;
  --color-accent-strong: #3f9a3d;
  --color-accent-soft: #edf8ed;
  --color-canvas: #f4f7fb;
  --color-surface-raised: #ffffff;
  --color-ink: #172b4d;
  --color-text-muted: #5f7087;
  --color-border-subtle: #d9e2ec;
  --color-focus: #0b5cab;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(23, 43, 77, 0.08), 0 3px 10px rgba(23, 43, 77, 0.04);
  --shadow-md: 0 8px 24px rgba(23, 43, 77, 0.11);
}

html {
  font-size: 16px;
}

body {
  background: var(--color-canvas);
  color: var(--color-ink);
  font-family: Inter, Roboto, Arial, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.5;
}

body * {
  letter-spacing: 0;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--color-ink);
  font-weight: 700;
  letter-spacing: 0;
}

h1, .h1 { font-size: 1.75rem; line-height: 1.2; }
h2, .h2 { font-size: 1.375rem; line-height: 1.25; }
h3, .h3 { font-size: 1.125rem; line-height: 1.3; }

a {
  color: var(--color-primary-strong);
}

a:hover {
  color: var(--color-primary);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  box-shadow: 0 0 0 3px rgba(11, 92, 171, 0.22) !important;
  outline: 2px solid transparent !important;
  outline-offset: 2px;
}

/* Shared surfaces used by legacy Bootstrap pages. */
.card,
.modal-content,
.dropdown-menu,
.list-group,
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border-color: var(--color-border-subtle) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-sm);
}

.card,
.modal-content,
.dropdown-menu {
  background-color: var(--color-surface-raised);
}

.card {
  overflow: hidden;
}

.card-header,
.modal-header {
  background: #fff;
  border-bottom-color: var(--color-border-subtle);
  padding: 1rem 1.25rem;
}

.card-body,
.modal-body {
  padding: 1.25rem;
}

.card-footer,
.modal-footer {
  background: #f8fafc;
  border-top-color: var(--color-border-subtle);
  padding: 1rem 1.25rem;
}

.list-group-item {
  border-color: var(--color-border-subtle);
  color: var(--color-ink);
}

.list-group-item-action:hover,
.list-group-item-action:focus {
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
}

/* Controls retain their native name, IDs, and behavior. */
.form-control,
.form-select,
select,
textarea,
input[type='text'],
input[type='search'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='date'] {
  background-color: #fff;
  border-color: #bdcad9;
  border-radius: var(--radius-sm);
  color: var(--color-ink);
  min-height: 42px;
}

.form-control:focus,
.form-select:focus,
select:focus,
textarea:focus,
input:focus {
  background-color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(11, 92, 171, 0.16);
  color: var(--color-ink);
}

textarea,
textarea.form-control {
  min-height: 108px;
}

.form-label,
label {
  color: var(--color-ink);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.form-text,
.text-muted,
small {
  color: var(--color-text-muted) !important;
}

.btn,
.ui-button {
  align-items: center;
  border-radius: var(--radius-sm);
  display: inline-flex;
  font-size: var(--font-size-sm);
  font-weight: 600;
  gap: 0.5rem;
  justify-content: center;
  letter-spacing: 0;
  min-height: 40px;
  padding: 0.5rem 0.875rem;
}

.btn-primary,
.btn-brand,
.ui-button-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.btn-primary:hover,
.btn-brand:hover,
.ui-button-primary:hover {
  background: var(--color-primary-strong);
  border-color: var(--color-primary-strong);
  color: #fff;
}

.btn-success {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

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

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

.btn-danger,
.btn-outline-danger {
  border-radius: var(--radius-sm);
}

.alert {
  border-radius: var(--radius-md);
  border-width: 1px;
  box-shadow: none;
}

.badge {
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  padding: 0.35rem 0.55rem;
}

/* Tables are designed as data surfaces rather than decorative cards. */
.table-responsive {
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--color-ink);
  --bs-table-border-color: var(--color-border-subtle);
  margin-bottom: 0;
}

.table > :not(caption) > * > * {
  padding: 0.8rem 0.9rem;
  vertical-align: middle;
}

.table thead th,
.table > thead > tr > th {
  background: #edf3f8;
  border-bottom-width: 1px;
  color: #36516c;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.table tbody tr:hover {
  background: #f7fbff;
}

.dataTables_wrapper {
  color: var(--color-ink);
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid #bdcad9;
  min-height: 38px;
  padding: 0.35rem 0.6rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border: 0 !important;
  border-radius: var(--radius-sm) !important;
  color: var(--color-primary-strong) !important;
  margin: 0 1px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--color-primary) !important;
  color: #fff !important;
}

/* Canonical authenticated shell. */
.app-shell-header {
  background: #fff;
  border-bottom: 1px solid var(--color-border-subtle);
  box-shadow: 0 1px 0 rgba(23, 43, 77, 0.04);
}

.app-shell-topbar {
  background: var(--color-primary);
}

.app-shell-topbar .app-shell-container {
  min-height: 60px;
}

.app-shell-brand {
  font-weight: 700;
}

.app-shell-brand-primary,
.app-shell-brand-secondary {
  font-size: 1rem;
}

.app-shell-footer {
  background: #eef3f8;
  border-top: 1px solid var(--color-border-subtle);
}

/* Legacy public login/header surfaces. */
.navbar-primary,
.navbar-secondary,
.navbar-login {
  box-shadow: none;
}

.navbar-primary {
  background: var(--color-primary) !important;
}

.navbar-secondary {
  background: linear-gradient(110deg, #1068b2 0%, #2d91a4 52%, #50b748 100%) !important;
}

.header-hero,
.header-hero#desktop {
  background: linear-gradient(110deg, #1068b2 0%, #2d91a4 52%, #50b748 100%) !important;
}

.profile-dropdown,
.dropdown-menu {
  padding: 0.4rem;
}

.dropdown-item {
  border-radius: var(--radius-sm);
  color: var(--color-ink);
  min-height: 38px;
  padding: 0.5rem 0.65rem;
}

/* The authenticated account menu is a dedicated dark panel, not a generic
 * Bootstrap dropdown. This rule intentionally follows the shared dropdown
 * normalization above. */
.dropdown-menu.app-shell-account-menu {
  background: #203667 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  border-radius: 16px !important;
  box-shadow: 0 16px 34px rgba(11, 38, 77, 0.28);
  padding: var(--space-3);
}

.app-shell-account-menu .app-shell-account-summary {
  background: transparent;
  border: 0;
}

.app-shell-account-menu .app-shell-account-summary strong,
.app-shell-account-menu .app-shell-menu-item,
.app-shell-account-menu .app-shell-account-action strong,
.app-shell-account-menu .app-shell-signout {
  color: #fff !important;
}

.app-shell-account-menu .app-shell-account-summary span,
.app-shell-account-menu .app-shell-account-action small {
  color: #b7c6e2 !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
}

.modal-backdrop.show {
  opacity: 0.46;
}

@media (max-width: 800px) {
  body { font-size: 0.9375rem; }

  .table > :not(caption) > * > * {
    padding: 0.7rem;
  }
}

@media (max-width: 800px) {
  h1, .h1 { font-size: 1.5rem; }
  h2, .h2 { font-size: 1.25rem; }

  .app-shell-topbar,
  .app-shell-topbar .app-shell-container {
    height: 60px;
    min-height: 60px;
  }

  .card-body,
  .modal-body,
  .card-header,
  .modal-header,
  .card-footer,
  .modal-footer { padding: 1rem; }

  .btn,
  .ui-button { min-height: 44px; }
}
