:root {
  --rh-bg: #f4f7fb;
  --rh-surface: #ffffff;
  --rh-surface-soft: #f8fafc;
  --rh-text: #172033;
  --rh-muted: #667085;
  --rh-border: #d9e2ef;
  --rh-border-soft: #e8eef6;
  --rh-primary: #2457d6;
  --rh-primary-dark: #173f9f;
  --rh-primary-soft: #eaf0ff;
  --rh-success-soft: #eaf8ef;
  --rh-warning-soft: #fff6df;
  --rh-danger-soft: #fff0f0;
  --rh-shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --rh-shadow-md: 0 10px 28px rgba(15, 23, 42, .08);
  --rh-shadow-lg: 0 18px 44px rgba(15, 23, 42, .10);
  --rh-radius-sm: .55rem;
  --rh-radius: .75rem;
  --rh-radius-lg: .95rem;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(36, 87, 214, .08), transparent 34rem),
    linear-gradient(180deg, #f8fbff 0%, var(--rh-bg) 42%, #eef3f9 100%) !important;
  color: var(--rh-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.auth-page {
  padding-top: 0 !important;
  background:
    radial-gradient(circle at 20% 15%, rgba(36, 87, 214, .18), transparent 28rem),
    radial-gradient(circle at 82% 78%, rgba(22, 135, 90, .12), transparent 24rem),
    linear-gradient(135deg, #eff5ff 0%, #f8fafc 48%, #eef3f9 100%) !important;
}

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

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

.container,
.container-fluid {
  --bs-gutter-x: 1.5rem;
}

.container-fluid.py-4,
.container.py-4 {
  padding-top: 2rem !important;
  padding-bottom: 2.5rem !important;
}

.navbar.bg-primary {
  background: linear-gradient(135deg, #153d91 0%, #2457d6 54%, #1d7adf 100%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 12px 30px rgba(16, 38, 84, .22);
}

.rh-navbar {
  min-height: 4.35rem;
}

.navbar .container-fluid {
  gap: .75rem;
}

.navbar-brand,
.rh-brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  min-height: 3.5rem;
  padding: .35rem .6rem .35rem .25rem;
  border-radius: .75rem;
  color: #fff !important;
  font-weight: 800;
  letter-spacing: 0;
  transition: background-color .18s ease, transform .18s ease;
}

.navbar-brand:hover,
.navbar-brand:focus {
  background: rgba(255, 255, 255, .10);
}

.rh-brand-logo {
  width: auto;
  max-width: 3.2rem;
  height: 3rem;
  object-fit: contain;
  padding: .2rem;
  border: 1px solid rgba(255, 255, 255, .92);
  border-radius: .625rem;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 4px 14px rgba(15, 23, 42, .18);
}

.rh-brand-text {
  display: grid;
  line-height: 1.08;
}

.rh-brand-text span {
  font-size: .98rem;
}

.rh-brand-text small {
  color: rgba(255, 255, 255, .74);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.rh-navbar-main {
  align-items: center;
  gap: .15rem;
}

.navbar .nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.55rem;
  margin: .1rem .03rem;
  padding: .62rem .78rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: rgba(255, 255, 255, .88) !important;
  font-size: .94rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus,
.navbar .nav-link.show {
  color: #fff !important;
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .12);
}

.navbar .nav-link.active {
  color: #102a63 !important;
  background: rgba(255, 255, 255, .94);
  border-color: rgba(255, 255, 255, .88);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .16);
}

.navbar .nav-link.active i {
  color: var(--rh-primary) !important;
}

.navbar .dropdown-toggle::after {
  margin-left: .45rem;
  opacity: .72;
}

.navbar .nav-link i,
.navbar .dropdown-item i {
  color: currentColor !important;
}

.navbar .dropdown-menu {
  min-width: 17rem;
  border: 1px solid rgba(217, 226, 239, .9);
  border-radius: var(--rh-radius);
  box-shadow: var(--rh-shadow-lg);
  padding: .55rem;
  margin-top: .5rem;
}

.navbar .dropdown-item {
  display: flex;
  align-items: center;
  gap: .25rem;
  min-height: 2.45rem;
  padding: .55rem .7rem;
  border-radius: .55rem;
  color: var(--rh-text);
  font-weight: 650;
}

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

.navbar .dropdown-item i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  margin-right: .35rem !important;
  border-radius: .5rem;
  background: #eef4ff;
  color: var(--rh-primary) !important;
  font-size: 1rem !important;
}

.navbar .dropdown-header {
  padding: .45rem .7rem .25rem;
  color: #64748b;
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.navbar .dropdown-divider {
  margin: .45rem .25rem;
  border-color: #e5edf7;
}

.navbar .btn-danger {
  --bs-btn-bg: rgba(220, 53, 69, .95);
  --bs-btn-border-color: rgba(255, 255, 255, .16);
  --bs-btn-hover-bg: #b42335;
  border-radius: .7rem;
  box-shadow: 0 8px 18px rgba(125, 18, 32, .24);
  font-weight: 700;
}

.rh-logout {
  min-height: 2.8rem;
  padding: .35rem .45rem .35rem .42rem;
}

.rh-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  color: #b42335;
  background: rgba(255, 255, 255, .95);
}

.rh-user-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.05;
}

.rh-user-action {
  font-size: .9rem;
}

.rh-user-label small {
  margin-top: .16rem;
  color: rgba(255, 255, 255, .78);
  font-size: .72rem;
  font-weight: 650;
}

.navbar-toggler {
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: .7rem;
}

.page-header {
  margin-bottom: 1.25rem;
  padding: 1.15rem 1.25rem;
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--rh-border-soft);
  border-radius: var(--rh-radius-lg);
  box-shadow: var(--rh-shadow-sm);
  backdrop-filter: blur(8px);
}

.page-header h1,
.page-header h2,
.page-header .h3 {
  color: #111827;
  font-weight: 750;
  letter-spacing: 0;
}

.page-header .text-muted,
.text-muted {
  color: var(--rh-muted) !important;
}

.card {
  border: 1px solid var(--rh-border-soft) !important;
  border-radius: var(--rh-radius-lg) !important;
  background: var(--rh-surface);
  box-shadow: var(--rh-shadow-md) !important;
  overflow: hidden;
}

.card-header {
  border-bottom: 1px solid var(--rh-border-soft) !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  color: var(--rh-text);
  font-weight: 700;
}

.card-body {
  color: var(--rh-text);
}

.row.g-3,
.row.g-4 {
  align-items: stretch;
}

.table {
  --bs-table-color: var(--rh-text);
  --bs-table-border-color: var(--rh-border-soft);
  margin-bottom: 0;
  font-size: .94rem;
}

.table thead th,
.table-light th {
  background: #eef4fb !important;
  color: #243044;
  border-bottom: 1px solid var(--rh-border);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
  vertical-align: middle;
}

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

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-bg-type: #fbfdff;
}

.table-hover > tbody > tr:hover > * {
  --bs-table-bg-state: #f0f6ff;
}

.table-responsive {
  border-radius: var(--rh-radius);
}

.table tfoot th,
.table tfoot td {
  background: #f8fafc;
  font-weight: 800;
}

.btn {
  border-radius: .62rem;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: none;
}

.btn-primary {
  --bs-btn-bg: var(--rh-primary);
  --bs-btn-border-color: var(--rh-primary);
  --bs-btn-hover-bg: var(--rh-primary-dark);
  --bs-btn-hover-border-color: var(--rh-primary-dark);
}

.btn-outline-primary {
  --bs-btn-color: var(--rh-primary);
  --bs-btn-border-color: #9db4ec;
  --bs-btn-hover-bg: var(--rh-primary);
  --bs-btn-hover-border-color: var(--rh-primary);
}

.btn-outline-secondary {
  --bs-btn-color: #475467;
  --bs-btn-border-color: #c7d3e2;
  --bs-btn-hover-bg: #eef4fb;
  --bs-btn-hover-border-color: #b8c7da;
  --bs-btn-hover-color: #243044;
}

.btn-sm {
  border-radius: .55rem;
}

.form-control,
.form-select,
.input-group-text {
  border-color: #cfd9e8;
  border-radius: .65rem;
  color: var(--rh-text);
}

.form-control,
.form-select {
  background-color: #fff;
}

.input-group > .form-control,
.input-group > .form-select,
.input-group > .input-group-text {
  border-radius: 0;
}

.input-group > :first-child {
  border-top-left-radius: .65rem !important;
  border-bottom-left-radius: .65rem !important;
}

.input-group > :last-child {
  border-top-right-radius: .65rem !important;
  border-bottom-right-radius: .65rem !important;
}

.form-control:focus,
.form-select:focus {
  border-color: #7ba0ef;
  box-shadow: 0 0 0 .22rem rgba(36, 87, 214, .14);
}

label,
.form-label {
  color: #344054;
  font-weight: 700;
}

.badge {
  border-radius: 999px;
  padding: .42em .66em;
  font-weight: 750;
}

.text-bg-light {
  color: #334155 !important;
  background-color: #eef4fb !important;
  border: 1px solid #d8e3f1;
}

.text-bg-success {
  background-color: #16875a !important;
}

.text-bg-warning {
  color: #6f4200 !important;
  background-color: #ffd56a !important;
}

.text-bg-danger {
  background-color: #c83245 !important;
}

.alert {
  border: 1px solid transparent;
  border-radius: var(--rh-radius);
  box-shadow: var(--rh-shadow-sm);
}

.alert-success {
  color: #17633f;
  background: var(--rh-success-soft);
  border-color: #b8e8cb;
}

.alert-warning {
  color: #7a4f00;
  background: var(--rh-warning-soft);
  border-color: #ffe2a6;
}

.alert-danger {
  color: #8f1d2c;
  background: var(--rh-danger-soft);
  border-color: #ffc7ce;
}

.nav-pills {
  gap: .35rem;
}

.nav-pills .nav-link {
  border: 1px solid transparent;
  border-radius: 999px !important;
  color: #475467;
  font-weight: 750;
}

.nav-pills .nav-link:hover {
  border-color: #cdd9ec;
  background: #f3f7fc;
}

.nav-pills .nav-link.active {
  background: var(--rh-primary);
  box-shadow: 0 8px 18px rgba(36, 87, 214, .20);
}

.modal-content {
  border: 1px solid var(--rh-border-soft);
  border-radius: var(--rh-radius-lg);
  box-shadow: var(--rh-shadow-lg);
}

.modal-header,
.modal-footer {
  border-color: var(--rh-border-soft);
  background: #f8fafc;
}

.toast {
  border-radius: var(--rh-radius);
  box-shadow: var(--rh-shadow-lg);
}

.login-card {
  width: min(24rem, calc(100vw - 2rem)) !important;
  border: 1px solid rgba(217, 226, 239, .95) !important;
  border-radius: 1rem !important;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .16) !important;
}

.login-card .login-logo {
  width: auto;
  max-width: 3.2rem;
  height: 3rem;
  object-fit: contain;
  padding: .2rem;
  border-radius: .625rem;
  background: #fff;
  border: 1px solid var(--rh-border-soft);
  box-shadow: var(--rh-shadow-sm);
}

.login-card h4 {
  color: #111827;
  font-weight: 800;
}

.preview-frame,
.preview-img {
  border: 1px solid var(--rh-border-soft) !important;
  box-shadow: var(--rh-shadow-sm);
}

.row-inactive {
  opacity: .62;
}

.filter-chip,
.slot-badge {
  border-radius: 999px;
}

/* Unified app components: RH + Compta visual language */
.card.p-3,
.card.p-4,
.card.shadow,
.card.h-100 {
  border-color: var(--rh-border-soft) !important;
}

.card > .d-flex:first-child h1,
.card > .d-flex:first-child h2,
.card > .d-flex:first-child .h4,
.card > .d-flex:first-child .h5,
.card > .d-flex:first-child .h6,
.card > h1,
.card > h2,
.card > .h4,
.card > .h5,
.card > .h6 {
  color: #111827;
  font-weight: 820;
  letter-spacing: 0;
}

.card form.row,
.card .row.g-2,
.card .row.g-3 {
  align-items: end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .38rem;
  min-height: 2.12rem;
  padding: .42rem .72rem;
  border-radius: .5rem;
  font-size: .88rem;
  line-height: 1.15;
}

.btn-sm {
  min-height: 1.78rem;
  padding: .25rem .5rem;
  border-radius: .45rem;
  font-size: .78rem;
}

.btn i {
  line-height: 1;
}

.btn-success {
  --bs-btn-bg: #16875a;
  --bs-btn-border-color: #16875a;
  --bs-btn-hover-bg: #116d49;
  --bs-btn-hover-border-color: #116d49;
}

.btn-danger {
  --bs-btn-bg: #c83245;
  --bs-btn-border-color: #c83245;
  --bs-btn-hover-bg: #a82838;
  --bs-btn-hover-border-color: #a82838;
}

.btn-warning {
  --bs-btn-bg: #f59e0b;
  --bs-btn-border-color: #f59e0b;
  --bs-btn-color: #111827;
  --bs-btn-hover-bg: #d98a06;
  --bs-btn-hover-border-color: #d98a06;
  --bs-btn-hover-color: #111827;
}

.btn-outline-danger {
  --bs-btn-color: #c83245;
  --bs-btn-border-color: #ef9da8;
  --bs-btn-hover-bg: var(--rh-danger-soft);
  --bs-btn-hover-border-color: #e57381;
  --bs-btn-hover-color: #9f2131;
}

.btn-outline-success {
  --bs-btn-color: #16875a;
  --bs-btn-border-color: #9fd8b9;
  --bs-btn-hover-bg: var(--rh-success-soft);
  --bs-btn-hover-border-color: #70c696;
  --bs-btn-hover-color: #0f6844;
}

.btn-group > .btn,
.dt-buttons .btn {
  margin-right: .32rem;
}

.dt-buttons,
.dataTables_wrapper .dt-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .65rem;
}

.dt-buttons .btn {
  margin-right: 0;
}

.form-control,
.form-select,
.input-group-text {
  min-height: 2.25rem;
  border-radius: .5rem;
}

.form-control-sm,
.form-select-sm {
  min-height: 2rem;
  border-radius: .45rem;
}

.form-control::placeholder {
  color: #98a2b3;
}

.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
  background-color: #eef2f7;
  color: #667085;
}

.form-check-input:checked {
  background-color: var(--rh-primary);
  border-color: var(--rh-primary);
}

.table {
  border-collapse: separate !important;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.table thead.table-dark th,
.table thead.table-dark td,
.table-dark th,
.table-dark td {
  background: #243044 !important;
  border-color: #344054 !important;
  color: #fff !important;
}

.table td,
.table th {
  border-color: var(--rh-border-soft) !important;
}

.table.table-sm td,
.table.table-sm th {
  padding-top: .45rem;
  padding-bottom: .45rem;
}

.table .btn {
  min-height: 1.75rem;
  padding: .24rem .48rem;
  border-radius: .45rem;
  font-size: .77rem;
}

.table .badge {
  font-weight: 760;
}

.table-responsive {
  border: 1px solid var(--rh-border-soft);
  background: var(--rh-surface);
  box-shadow: var(--rh-shadow-sm);
}

.dataTables_wrapper {
  padding-top: .25rem;
}

div.dataTables_wrapper div.row:first-child,
div.dataTables_wrapper div.row:last-child {
  align-items: center;
}

div.dataTables_wrapper div.row:first-child {
  margin-bottom: .75rem;
}

div.dataTables_wrapper div.row:last-child {
  margin-top: .75rem;
}

div.dataTables_wrapper div.dataTables_length select,
div.dataTables_wrapper div.dataTables_filter input {
  min-height: 2.12rem;
  border: 1px solid #cfd9e8;
  border-radius: .5rem;
  color: var(--rh-text);
}

div.dataTables_wrapper div.dataTables_filter input {
  padding: .38rem .75rem;
}

.dataTables_info,
.dataTables_length label,
.dataTables_filter label {
  color: var(--rh-muted) !important;
  font-size: .88rem;
  font-weight: 650;
}

table.dataTable {
  border-top: 0 !important;
}

table.dataTable.no-footer {
  border-bottom: 0 !important;
}

table.dataTable > thead > tr > th,
table.dataTable > thead > tr > td {
  border-bottom: 1px solid var(--rh-border) !important;
}

.pagination .page-link {
  min-width: 2.05rem;
  margin: 0 .12rem;
  border: 1px solid var(--rh-border-soft);
  border-radius: .5rem;
  color: #475467;
  text-align: center;
}

.pagination .page-link:hover {
  background: var(--rh-primary-soft);
  color: var(--rh-primary-dark);
}

.page-item.active .page-link {
  background: var(--rh-primary);
  border-color: var(--rh-primary);
  color: #fff;
}

@media (max-width: 991.98px) {
  body {
    padding-top: 76px !important;
  }

  .navbar .navbar-collapse {
    margin-top: .6rem;
    padding: .65rem;
    border-radius: var(--rh-radius);
    background: rgba(15, 45, 105, .40);
  }

  .rh-navbar-main {
    align-items: stretch;
    gap: .15rem;
  }

  .navbar .nav-link {
    display: flex;
    justify-content: flex-start;
    margin: .12rem 0;
    border-radius: .75rem;
    white-space: normal;
  }

  .navbar .dropdown-menu {
    margin-top: .2rem;
    box-shadow: none;
    border-color: rgba(255, 255, 255, .22);
    background: rgba(255, 255, 255, .96);
  }

  .navbar .btn-danger {
    justify-content: center;
    margin-top: .5rem;
    width: 100%;
  }

  .page-header {
    padding: 1rem;
  }

  .container-fluid.py-4,
  .container.py-4 {
    padding-top: 1.25rem !important;
  }
}

@media (max-width: 575.98px) {
  .container,
  .container-fluid {
    --bs-gutter-x: 1rem;
  }

  .page-header h1,
  .page-header h2,
  .page-header .h3 {
    font-size: 1.25rem;
  }

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

  .table {
    font-size: .88rem;
  }

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

@media print {
  body {
    background: #fff !important;
  }

  .navbar,
  .no-print {
    display: none !important;
  }

  .card,
  .page-header {
    box-shadow: none !important;
    border-color: #d0d5dd !important;
  }
}
