:root {
  --shell-navy: #1e2f5d;
  --shell-navy-deep: #142248;
  --shell-border: rgba(255, 255, 255, 0.16);
}

.app-bar {
  border-bottom: 1px solid var(--shell-border);
  box-shadow: 0 8px 30px rgba(11, 18, 32, 0.14);
}

.app-navbar {
  background: linear-gradient(110deg, var(--shell-navy) 0%, var(--shell-navy-deep) 100%);
  background-color: var(--shell-navy);
  min-height: 64px;
}

.app-navbar__container {
  max-width: 1680px;
}

.app-brand {
  font-weight: 700;
  letter-spacing: 0.03em;
}

.app-nav-list .nav-link {
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  color: rgba(255, 255, 255, 0.9);
}

.app-nav-list .nav-link:hover,
.app-nav-list .nav-link:focus {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.12);
}

.app-nav-list .nav-link.active {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.2);
}

.app-user-pill {
  display: inline-flex;
  align-items: center;
  max-width: 240px;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.with-app-shell .page {
  display: block;
  place-items: initial;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  min-height: calc(100vh - 64px);
  padding: 20px;
}

body.with-app-shell {
  color: var(--fg);
  background-color: var(--bg);
}

body.with-app-shell h1,
body.with-app-shell h2,
body.with-app-shell h3,
body.with-app-shell h4,
body.with-app-shell h5,
body.with-app-shell h6 {
  color: var(--fg);
}

body.with-app-shell .card {
  width: 100%;
  max-width: none;
  border-radius: 16px;
  padding: 24px;
}

body.with-app-shell .card + .card {
  margin-top: 16px;
}

body.with-app-shell h1 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.45rem, 2.2vw, 2rem);
}

body.with-app-shell h2 {
  margin-top: 1.25rem;
}

body.with-app-shell .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

body.with-app-shell .actions > a,
body.with-app-shell .actions > button,
body.with-app-shell .actions > form > button,
body.with-app-shell .actions > form > a,
body.with-app-shell .actions-cell > a,
body.with-app-shell .actions-cell > button,
body.with-app-shell .actions-cell > form > button,
body.with-app-shell .actions-cell > form > a {
  min-height: 44px;
  min-width: 0;
  padding: 0.4rem 0.8rem;
  border: 1px solid #86b0ff;
  border-radius: 0.45rem;
  background: #eef4ff;
  color: #1b4b9d;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
}

body.with-app-shell .actions > a:hover,
body.with-app-shell .actions > button:hover,
body.with-app-shell .actions > form > button:hover,
body.with-app-shell .actions > form > a:hover,
body.with-app-shell .actions-cell > a:hover,
body.with-app-shell .actions-cell > button:hover,
body.with-app-shell .actions-cell > form > button:hover,
body.with-app-shell .actions-cell > form > a:hover {
  border-color: #4f8cff;
  background: #dde9ff;
  color: #163f83;
}

body.with-app-shell button:not(.navbar-toggler):not(.btn),
body.with-app-shell a.button-secondary,
body.with-app-shell button.button-secondary,
body.with-app-shell a.button-danger,
body.with-app-shell button.button-danger {
  min-height: 44px;
  padding: 0.4rem 0.8rem;
  border-radius: 0.45rem;
  font-size: 0.9rem;
  line-height: 1.25;
}

body.with-app-shell .form,
body.with-app-shell .form-grid {
  display: grid;
  gap: 0.85rem;
}

body.with-app-shell .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

body.with-app-shell label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
}

body.with-app-shell input:not([type="checkbox"]):not([type="radio"]),
body.with-app-shell select,
body.with-app-shell textarea {
  width: 100%;
  min-height: 2.35rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid #b9c8e6;
  border-radius: 0.45rem;
  background: #fff;
  color: #1b2d50;
}

body.with-app-shell .data-table {
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
}

body.with-app-shell .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f3f7ff;
  color: #425574;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

body.with-app-shell .data-table th,
body.with-app-shell .data-table td {
  padding: 0.72rem 0.68rem;
  border-color: #d5e0f4;
}

body.with-app-shell .table-wrap {
  margin-top: 0.9rem;
  border: 1px solid #d9e3f6;
  border-radius: 0.7rem;
  background: #fff;
}

body.with-app-shell .table-wrap .data-table tr:first-child td {
  border-top: 0;
}

body.with-app-shell .badge {
  background: #e8efff;
  color: #274982;
}

body.with-app-shell .admin-nav {
  margin-bottom: 1rem;
}

body.with-app-shell .admin-nav .admin-link {
  border-color: #bfd2fa;
  background: #f2f6ff;
  color: #2a4c89;
}

body.with-app-shell .admin-nav .admin-link.active,
body.with-app-shell .admin-nav .admin-link.is-active {
  border-color: #4d83ea;
  background: #2f64c7;
  color: #fff;
}

body.with-app-shell .actions a.btn,
body.with-app-shell button.btn {
  min-height: auto;
  border-width: var(--bs-btn-border-width);
  border-style: solid;
  border-color: var(--bs-btn-border-color);
  border-radius: var(--bs-btn-border-radius);
  background-color: var(--bs-btn-bg);
  color: var(--bs-btn-color);
  font-weight: var(--bs-btn-font-weight);
  line-height: var(--bs-btn-line-height);
  text-decoration: none;
  box-shadow: var(--bs-btn-box-shadow);
}

body.with-app-shell .actions a.btn:hover,
body.with-app-shell button.btn:hover {
  border-color: var(--bs-btn-hover-border-color);
  background-color: var(--bs-btn-hover-bg);
  color: var(--bs-btn-hover-color);
}

body.with-app-shell .actions a.btn:focus-visible,
body.with-app-shell button.btn:focus-visible {
  outline: 0;
  box-shadow: var(--bs-btn-focus-box-shadow);
}

body.with-app-shell .support-filters-form {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: end;
}

@media (max-width: 991.98px) {
  body.with-app-shell .page {
    padding: 14px;
  }

  body.with-app-shell .card {
    padding: 16px;
    border-radius: 14px;
  }

  body.with-app-shell .form-grid,
  body.with-app-shell .support-filters-form {
    grid-template-columns: 1fr;
  }

  body.with-app-shell .data-table {
    min-width: 700px;
  }

  .app-nav-actions {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
  }

.app-user-pill {
    max-width: 100%;
  }
}

.app-nav-actions .btn-outline-light,
.app-nav-actions .btn-light {
  border-color: #f8f9fa;
  background: transparent;
  color: #f8f9fa !important;
}

.app-nav-actions .btn-outline-light:hover,
.app-nav-actions .btn-light:hover {
  border-color: #ffffff;
  background: rgba(248, 249, 250, 0.15);
  color: #ffffff !important;
}

:root[data-theme="dark"] .app-navbar {
  background-color: #111c31;
}

:root[data-theme="dark"] body.with-app-shell .actions > a,
:root[data-theme="dark"] body.with-app-shell .actions > button,
:root[data-theme="dark"] body.with-app-shell .actions > form > button,
:root[data-theme="dark"] body.with-app-shell .actions > form > a,
:root[data-theme="dark"] body.with-app-shell .actions-cell > a,
:root[data-theme="dark"] body.with-app-shell .actions-cell > button,
:root[data-theme="dark"] body.with-app-shell .actions-cell > form > button,
:root[data-theme="dark"] body.with-app-shell .actions-cell > form > a {
  border-color: #4f78b9;
  background: #213557;
  color: #eaf2ff;
}

:root[data-theme="dark"] body.with-app-shell .actions > a:hover,
:root[data-theme="dark"] body.with-app-shell .actions > button:hover,
:root[data-theme="dark"] body.with-app-shell .actions > form > button:hover,
:root[data-theme="dark"] body.with-app-shell .actions > form > a:hover,
:root[data-theme="dark"] body.with-app-shell .actions-cell > a:hover,
:root[data-theme="dark"] body.with-app-shell .actions-cell > button:hover,
:root[data-theme="dark"] body.with-app-shell .actions-cell > form > button:hover,
:root[data-theme="dark"] body.with-app-shell .actions-cell > form > a:hover {
  border-color: #79a9f1;
  background: #2a426a;
  color: #ffffff;
}

:root[data-theme="dark"] body.with-app-shell input:not([type="checkbox"]):not([type="radio"]),
:root[data-theme="dark"] body.with-app-shell select,
:root[data-theme="dark"] body.with-app-shell textarea,
:root[data-theme="dark"] body.with-app-shell .table-input,
:root[data-theme="dark"] body.with-app-shell .table-select {
  border-color: #3e5d8f;
  background: #13233c;
  color: #eef4ff;
}

:root[data-theme="dark"] body.with-app-shell .table-wrap {
  border-color: #2d466e;
  background: #13233c;
}

:root[data-theme="dark"] body.with-app-shell .data-table thead th {
  background: #1a2f4d;
  color: #d6e4ff;
}

:root[data-theme="dark"] body.with-app-shell .data-table th,
:root[data-theme="dark"] body.with-app-shell .data-table td {
  border-color: #2d466e;
  color: #eef4ff;
}

:root[data-theme="dark"] body.with-app-shell .hint,
:root[data-theme="dark"] body.with-app-shell .muted,
:root[data-theme="dark"] body.with-app-shell .badge,
:root[data-theme="dark"] body.with-app-shell .data-table th,
:root[data-theme="dark"] body.with-app-shell .admin-link,
:root[data-theme="dark"] body.with-app-shell .role-options,
:root[data-theme="dark"] body.with-app-shell .role-options label {
  color: #d9e7ff;
}

:root[data-theme="dark"] body.with-app-shell .badge {
  background: #2a426a;
}

:root[data-theme="dark"] body.with-app-shell .admin-nav .admin-link {
  border-color: #4f74b0 !important;
  background: #243d63 !important;
  color: #f3f8ff !important;
}

:root[data-theme="dark"] body.with-app-shell .admin-nav .admin-link.active,
:root[data-theme="dark"] body.with-app-shell .admin-nav .admin-link.is-active {
  border-color: #9ec0ff !important;
  background: #2f64c7 !important;
  color: #ffffff !important;
}
