﻿:root {
  --dk-primary: #4f46e5;
  --dk-primary-dark: #3730a3;
  --dk-primary-soft: #eef2ff;
  --dk-navy: #172033;
  --dk-teal: #0f766e;
  --dk-danger: #dc3545;
  --dk-warning: #f59e0b;
  --dk-success: #15803d;

  --dk-background: #f6f7fb;
  --dk-surface: #ffffff;
  --dk-surface-muted: #f8fafc;
  --dk-border: #e2e8f0;
  --dk-border-strong: #cbd5e1;

  --dk-text: #172033;
  --dk-text-muted: #64748b;

  --dk-radius-sm: 0.65rem;
  --dk-radius: 0.9rem;
  --dk-radius-lg: 1.25rem;

  --dk-shadow-sm:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 4px 12px rgba(15, 23, 42, 0.04);

  --dk-shadow:
    0 2px 4px rgba(15, 23, 42, 0.04),
    0 12px 30px rgba(15, 23, 42, 0.07);

  --dk-focus:
    0 0 0 0.22rem rgba(79, 70, 229, 0.2);
}

html {
  position: relative;
  min-height: 100%;
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--dk-background);
  color: var(--dk-text);
  font-family:
    Inter,
    "Segoe UI Variable",
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body > .container {
  flex: 1 0 auto;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--dk-navy);
  font-weight: 700;
  letter-spacing: -0.02em;
}

p {
  text-wrap: pretty;
}

a {
  color: var(--dk-primary);
  text-underline-offset: 0.18em;
}

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

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #312e81;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2000;
  padding: 0.7rem 1rem;
  border-radius: 0.7rem;
  color: #ffffff;
  background: var(--dk-navy);
  font-weight: 700;
  transform: translateY(-160%);
}

.skip-link:focus {
  color: #ffffff;
  transform: translateY(0);
}

.text-primary {
  color: var(--dk-primary) !important;
}

.text-secondary {
  color: var(--dk-text-muted) !important;
}

/* Navigation */

.navbar {
  min-height: 4.5rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 1px 10px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(12px);
}

.navbar-brand {
  color: var(--dk-navy) !important;
  font-size: 1.3rem;
  font-weight: 800 !important;
  letter-spacing: -0.035em;
}

.navbar-brand::before {
  content: "";
  display: inline-block;
  width: 0.72rem;
  height: 0.72rem;
  margin-right: 0.55rem;
  border-radius: 0.24rem;
  background:
    linear-gradient(
      135deg,
      var(--dk-primary),
      #7c3aed
    );
  box-shadow: 0 0 0 0.22rem var(--dk-primary-soft);
}

.navbar .nav-link {
  position: relative;
  padding: 0.62rem 0.8rem !important;
  border-radius: 0.6rem;
  color: #475569 !important;
  font-weight: 500;
  transition:
    color 160ms ease,
    background-color 160ms ease;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: var(--dk-primary) !important;
  background: var(--dk-primary-soft);
}

.navbar-toggler {
  padding: 0.45rem 0.6rem;
  border-color: var(--dk-border);
  border-radius: 0.7rem;
}

.navbar-toggler:focus {
  box-shadow: var(--dk-focus);
}

.dropdown-menu {
  padding: 0.5rem;
  border: 1px solid var(--dk-border);
  border-radius: var(--dk-radius);
  box-shadow: var(--dk-shadow);
}

.dropdown-item {
  padding: 0.62rem 0.75rem;
  border-radius: 0.55rem;
  color: var(--dk-text);
  font-weight: 500;
}

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

.dropdown-divider {
  border-color: var(--dk-border);
}

/* Page layout */

main {
  width: 100%;
}

main:focus {
  outline: none;
}

.system-message {
  max-width: 46rem;
  margin: clamp(3rem, 10vh, 7rem) auto;
  padding: clamp(2rem, 6vw, 4rem);
  border: 1px solid var(--dk-border);
  border-radius: var(--dk-radius-lg);
  background: var(--dk-surface);
  box-shadow: var(--dk-shadow);
  text-align: center;
}

.system-message-icon {
  display: grid;
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.25rem;
  place-items: center;
  border-radius: 1.2rem;
  color: var(--dk-primary);
  background: var(--dk-primary-soft);
  font-size: 1.65rem;
  font-weight: 800;
}

.system-message h1 {
  margin-bottom: 0.8rem;
  font-size: clamp(2rem, 6vw, 3rem);
}

.system-message > p:not(.page-eyebrow):not(.system-reference) {
  max-width: 38rem;
  margin-right: auto;
  margin-left: auto;
  color: var(--dk-text-muted);
  font-size: 1.08rem;
}

.system-message-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.system-reference {
  margin-top: 1.5rem;
  color: var(--dk-text-muted);
  font-size: 0.85rem;
}

.is-submitting {
  cursor: wait !important;
  opacity: 0.72;
  pointer-events: none;
}

.container {
  --bs-gutter-x: 2rem;
}

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

/* Cards */

.card {
  background: var(--dk-surface);
  border: 1px solid rgba(226, 232, 240, 0.8) !important;
  border-radius: var(--dk-radius-lg);
  box-shadow: var(--dk-shadow-sm) !important;
}

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

.card .display-6 {
  color: var(--dk-navy);
  font-size: clamp(2rem, 5vw, 2.8rem);
  letter-spacing: -0.045em;
}

/* Buttons */

.btn {
  min-height: 2.75rem;
  padding: 0.58rem 1rem;
  border-radius: 0.72rem;
  font-weight: 650;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #ffffff;
  background: var(--dk-primary);
  border-color: var(--dk-primary);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.18);
}

.btn-primary:hover,
.btn-primary:focus {
  color: #ffffff;
  background: var(--dk-primary-dark);
  border-color: var(--dk-primary-dark);
}

.btn-outline-primary {
  color: var(--dk-primary);
  border-color: #a5b4fc;
  background: #ffffff;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  color: var(--dk-primary-dark);
  border-color: #818cf8;
  background: var(--dk-primary-soft);
}

.btn-outline-secondary {
  color: #475569;
  border-color: var(--dk-border-strong);
  background: #ffffff;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  color: var(--dk-navy);
  border-color: #94a3b8;
  background: var(--dk-surface-muted);
}

.btn-outline-danger {
  color: var(--dk-danger);
  border-color: #fda4af;
  background: #ffffff;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
  color: #ffffff;
  border-color: var(--dk-danger);
  background: var(--dk-danger);
}

.btn-danger {
  border-color: var(--dk-danger);
  background: var(--dk-danger);
}

.btn-lg {
  min-height: 3.15rem;
  padding: 0.72rem 1.25rem;
  border-radius: 0.82rem;
  font-size: 1rem;
}

.btn-sm {
  min-height: 2.2rem;
  padding: 0.4rem 0.72rem;
  border-radius: 0.58rem;
  font-size: 0.86rem;
}

.btn:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible {
  box-shadow: var(--dk-focus) !important;
  outline: none;
}

/* Forms */

.form-label {
  margin-bottom: 0.45rem;
  color: #334155;
  font-size: 0.92rem;
  font-weight: 650;
}

.form-control,
.form-select {
  min-height: 3rem;
  padding: 0.65rem 0.85rem;
  color: var(--dk-text);
  background-color: #ffffff;
  border: 1px solid var(--dk-border-strong);
  border-radius: 0.72rem;
}

textarea.form-control {
  min-height: 7rem;
}

.form-control::placeholder {
  color: #94a3b8;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: #818cf8;
  box-shadow: var(--dk-focus);
}

.form-check-input {
  border-color: #94a3b8;
}

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

.form-switch .form-check-input {
  width: 2.65rem;
  height: 1.4rem;
}

.input-validation-error {
  border-color: var(--dk-danger);
}

.field-validation-error,
.text-danger {
  color: var(--dk-danger) !important;
}

/* Tables */

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

.table {
  --bs-table-bg: transparent;
  color: var(--dk-text);
}

.table > :not(caption) > * > * {
  padding: 1rem;
  border-bottom-color: var(--dk-border);
}

.table thead th {
  color: #475569;
  background: var(--dk-surface-muted);
  border-bottom-width: 1px;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

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

/* Badges and status */

.badge {
  padding: 0.45em 0.7em;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.text-bg-primary {
  color: #3730a3 !important;
  background: #e0e7ff !important;
}

.text-bg-success {
  color: #166534 !important;
  background: #dcfce7 !important;
}

.text-bg-warning {
  color: #92400e !important;
  background: #fef3c7 !important;
}

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

.text-bg-secondary {
  color: #475569 !important;
  background: #e2e8f0 !important;
}

/* Alerts */

.alert {
  border: 0;
  border-radius: var(--dk-radius);
  box-shadow: var(--dk-shadow-sm);
}

.alert-success {
  color: #166534;
  background: #ecfdf3;
}

.alert-warning {
  color: #92400e;
  background: #fffbeb;
}

.alert-danger {
  color: #991b1b;
  background: #fef2f2;
}

/* Lists */

.list-group {
  border-radius: var(--dk-radius);
}

.list-group-item {
  color: var(--dk-text);
  background: transparent;
  border-color: var(--dk-border);
}

.list-group-item-action:hover,
.list-group-item-action:focus {
  color: var(--dk-text);
  background: #f8faff;
}

.bg-primary-subtle {
  background: var(--dk-primary-soft) !important;
}

/* Footer */

.footer {
  flex-shrink: 0;
  margin-top: 2rem;
  padding: 1.5rem 0;
  color: var(--dk-text-muted) !important;
  background: #ffffff;
  border-color: var(--dk-border) !important;
}

/* Utility improvements */

.shadow-sm {
  box-shadow: var(--dk-shadow-sm) !important;
}

.small,
small {
  line-height: 1.45;
}

.text-uppercase {
  letter-spacing: 0.07em;
}

::selection {
  color: var(--dk-navy);
  background: #c7d2fe;
}

/* Responsive behaviour */

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }

  .py-4 {
    padding-top: 2.75rem !important;
    padding-bottom: 3rem !important;
  }
}

@media (max-width: 991.98px) {
  .navbar-collapse {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #ffffff;
    border: 1px solid var(--dk-border);
    border-radius: var(--dk-radius);
    box-shadow: var(--dk-shadow);
  }

  .navbar-nav {
    gap: 0.2rem;
  }

  .navbar .dropdown-menu {
    margin: 0.25rem 0 0.5rem;
    border: 0;
    box-shadow: none;
    background: var(--dk-surface-muted);
  }
}

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

  .py-4 {
    padding-top: 1.5rem !important;
    padding-bottom: 2rem !important;
  }

  h1,
  .h1 {
    font-size: 1.85rem;
  }

  .h2 {
    font-size: 1.55rem;
  }

  .card-body {
    padding: 1.15rem;
  }
.navbar .btn,
  .navbar form {
    width: auto;
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Mobile app navigation */

.mobile-bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1030;
  height: calc(4.4rem + env(safe-area-inset-bottom));
  padding:
    0.42rem
    max(0.65rem, env(safe-area-inset-right))
    env(safe-area-inset-bottom)
    max(0.65rem, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--dk-border);
  box-shadow: 0 -8px 26px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(14px);
}

.mobile-nav-link {
  min-width: 0;
  height: 3.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  color: #64748b;
  border-radius: 0.7rem;
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
}

.mobile-nav-link svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus,
.mobile-nav-link.active {
  color: var(--dk-primary);
  background: var(--dk-primary-soft);
}

.mobile-nav-add {
  width: 3.35rem;
  height: 3.35rem;
  margin: -1.45rem auto 0;
  display: grid;
  place-items: center;
  color: #ffffff;
  background:
    linear-gradient(
      135deg,
      var(--dk-primary),
      #7c3aed
    );
  border: 0.3rem solid var(--dk-background);
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
  text-decoration: none;
}

.mobile-nav-add:hover,
.mobile-nav-add:focus {
  color: #ffffff;
  transform: translateY(-2px);
}

@media (max-width: 991.98px) {
  body {
    padding-bottom:
      calc(4.4rem + env(safe-area-inset-bottom));
  }

  .footer {
    margin-bottom: 0;
  }
}

@media (min-width: 992px) {
  .mobile-bottom-nav {
    display: none !important;
  }
}

/* Navigation account and notifications */

.notification-nav-link {
  display: flex !important;
  align-items: center;
  gap: 0.4rem;
}

.notification-nav-link svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notification-nav-badge {
  min-width: 1.28rem;
  height: 1.28rem;
  padding: 0 0.35rem;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  background: #e11d48;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 750;
  line-height: 1;
}

.account-menu-toggle {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
}

.account-avatar {
  width: 2rem;
  height: 2rem;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  background:
    linear-gradient(
      135deg,
      var(--dk-primary),
      #7c3aed
    );
  border-radius: 0.65rem;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1;
}

.account-avatar.large {
  width: 2.6rem;
  height: 2.6rem;
  flex-shrink: 0;
  border-radius: 0.8rem;
  font-size: 0.95rem;
}

.account-short-name {
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu {
  width: min(19rem, calc(100vw - 2rem));
  padding: 0.6rem;
}

.account-menu-header {
  padding: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.account-menu-header > span:last-child {
  min-width: 0;
}

.account-menu-header strong,
.account-menu-header small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-header strong {
  color: var(--dk-navy);
  font-size: 0.88rem;
}

.account-menu-header small {
  color: var(--dk-text-muted);
  font-size: 0.7rem;
}

.account-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.account-menu-item svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-logout {
  width: 100%;
  color: var(--dk-danger);
  border: 0;
  background: transparent;
  text-align: left;
}

.account-logout:hover,
.account-logout:focus {
  color: #be123c;
  background: #fff1f2;
}

.navbar-register-button {
  min-height: 2.5rem;
  margin-left: 0.35rem;
  display: inline-flex;
  align-items: center;
}

@media (max-width: 991.98px) {
  .account-short-name {
    max-width: none;
  }

  .navbar-register-button {
    width: 100%;
    margin: 0.4rem 0 0;
    justify-content: center;
  }

  .account-menu {
    width: 100%;
    border: 0;
    background: var(--dk-surface-muted);
    box-shadow: none;
  }
}
/* Keep navigation menus above page content */

header {
  position: relative;
  z-index: 1050;
}

.navbar {
  position: relative;
  z-index: 1050;
  overflow: visible;
}

.navbar-collapse {
  position: relative;
  z-index: 1051;
}

.navbar .dropdown-menu {
  z-index: 1060;
}

main {
  position: relative;
  z-index: 1;
}
