:root {
  --app-bg: #f3f6fb;
  --app-surface: #ffffff;
  --app-surface-soft: #f8fafc;
  --app-ink: #132136;
  --app-muted: #5f6f87;
  --app-border: #d9e1ee;
  --app-primary: #3a6ea5;
  --app-primary-strong: #2f5f92;
  --app-accent: #1fbf91;
  --app-shadow-sm: 0 8px 22px rgba(17, 35, 65, 0.08);
  --app-shadow-md: 0 16px 34px rgba(17, 35, 65, 0.12);
}

body.app-body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--app-ink);
  background:
    radial-gradient(1200px 520px at 5% -15%, #d8ecff 0%, transparent 58%),
    radial-gradient(900px 460px at 100% -20%, #d9f8eb 0%, transparent 52%),
    var(--app-bg);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.app-sidebar {
  background: linear-gradient(185deg, #15233a 0%, #1d2d46 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.app-sidebar-brand {
  display: block;
  margin: 0.1rem 0.35rem 1.1rem;
  text-decoration: none;
  font-size: 1.06rem;
}

.app-sidebar-section {
  margin-top: 0.4rem;
}

.app-sidebar-title {
  color: rgba(215, 226, 246, 0.66);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0.45rem 0.55rem;
}

.app-sidebar-nav {
  display: grid;
  gap: 0.3rem;
}

.app-side-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: rgba(233, 241, 255, 0.88);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.58rem 0.7rem;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.app-side-link:hover {
  transform: translateX(2px);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.app-side-link.is-active {
  color: #fff;
  background: rgba(62, 113, 176, 0.35);
  border-color: rgba(176, 205, 246, 0.35);
}

.app-shell-main {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.9rem 1.2rem;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--app-border);
}

.app-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.app-top-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cdd9ea;
  background: #fff;
  color: #244060;
  border-radius: 999px;
  padding: 0.35rem 0.62rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.app-main {
  min-height: 0;
}

.app-content-wrap {
  padding: 1rem 1.2rem 1.3rem;
  animation: app-fade-in 0.28s ease-out;
}

.app-navbar {
  background: linear-gradient(120deg, #1f2d45 0%, #2a3b59 56%, #314868 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-brand {
  font-family: "Sora", "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
  color: #f8fbff !important;
  text-shadow: 0 1px 1px rgba(7, 13, 24, 0.35);
}

.app-brand:hover,
.app-brand:focus {
  color: #ffffff !important;
}

.app-muted {
  color: rgba(232, 239, 253, 0.78);
}

.app-nav-btn {
  border-color: rgba(230, 239, 255, 0.35);
  color: #e9f1ff;
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.app-nav-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(230, 239, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
}

.app-logout-btn {
  color: #12233e;
  border-color: transparent;
  font-weight: 600;
}

h1, h2, h3, h4, h5 {
  font-family: "Sora", "Manrope", sans-serif;
  letter-spacing: -0.01em;
  color: #12203a;
}

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

.card {
  background: var(--app-surface);
  border: 1px solid var(--app-border) !important;
  border-radius: 14px;
  box-shadow: var(--app-shadow-sm);
}

.card-header {
  background: linear-gradient(180deg, #fcfdff 0%, #f7faff 100%) !important;
  border-bottom: 1px solid var(--app-border) !important;
  border-top-left-radius: 14px !important;
  border-top-right-radius: 14px !important;
}

.table {
  --bs-table-bg: transparent;
}

.table > :not(caption) > * > * {
  border-bottom-color: #e7edf7;
}

.table thead th {
  color: #35507d;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

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

.form-control,
.form-select {
  border-radius: 10px;
  border-color: #cfd8e7;
  background: #fff;
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 2.2rem;
  border-color: #b9c9e2;
  background-color: #f8fbff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath fill='%233f5f8b' d='M2 2l5 5 5-5 1 1-6 6-6-6z'/%3E%3C/svg%3E");
  background-position: right 0.72rem center;
  background-size: 14px 10px;
  background-repeat: no-repeat;
}

.form-control:focus,
.form-select:focus {
  border-color: #95b9ff;
  box-shadow: 0 0 0 0.22rem rgba(31, 94, 255, 0.18);
}

.btn {
  border-radius: 10px;
  font-weight: 600;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

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

.btn-dark {
  background: linear-gradient(120deg, var(--app-primary) 0%, var(--app-primary-strong) 100%);
  border-color: transparent;
  box-shadow: 0 8px 16px rgba(47, 95, 146, 0.22);
}

.btn-dark:hover,
.btn-dark:focus {
  background: linear-gradient(120deg, #35689e 0%, #2a567f 100%);
}

.btn-outline-secondary {
  border-color: #bfccdf;
  color: #28405f;
  background: #fff;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background: #f4f8ff;
  color: #1f395f;
  border-color: #9fb4d4;
}

.alert {
  border-radius: 12px;
  border: 1px solid #d3e2ff;
  box-shadow: var(--app-shadow-sm);
}

.app-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.app-page-title {
  margin: 0;
  font-size: clamp(1.35rem, 2.1vw, 1.8rem);
}

.app-page-subtitle {
  margin: 0.25rem 0 0;
  color: var(--app-muted);
}

.app-page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.app-kpi-card {
  position: relative;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.app-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--app-shadow-md);
  border-color: rgba(58, 110, 165, 0.34);
}

.app-kpi-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #537096;
  font-weight: 700;
}

.app-kpi-value {
  font-size: clamp(1.55rem, 2.5vw, 2rem);
  line-height: 1.1;
  margin-top: 0.25rem;
  color: #142845;
}

.app-tile-hover {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.app-tile-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(17, 35, 65, 0.11);
  border-color: rgba(58, 110, 165, 0.35) !important;
  background: #f7fbff;
}

.app-filter-toolbar .card-body {
  padding: 0.95rem 1rem;
}

.app-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.app-tab-shell .nav-tabs {
  border-bottom-color: #d5e0ef;
}

.app-tab-shell .nav-link {
  color: #37567f;
  border: 1px solid transparent;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.app-tab-shell .nav-link.active {
  background: #fff;
  color: #173256;
  border-color: #d5e0ef #d5e0ef #fff;
  font-weight: 700;
}

.app-empty-state {
  text-align: center;
  padding: 1.2rem 1rem;
  color: var(--app-muted);
}

.app-empty-title {
  font-weight: 700;
  color: #28405f;
}

.app-empty-text {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
}

.app-status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.36rem 0.56rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.app-status-badge.is-open {
  color: #1a6a53;
  background: #e8fbf3;
  border-color: #b9ebd7;
}

.app-status-badge.is-complete {
  color: #5a3f13;
  background: #fff7df;
  border-color: #f0dc9d;
}

.app-status-badge.is-new {
  color: #1f4d91;
  background: #eaf2ff;
  border-color: #c7dbff;
}

.pagination .page-link {
  border-radius: 8px;
  border-color: #c7d4e8;
  color: #2a466c;
}

.pagination .page-item + .page-item {
  margin-left: 0.3rem;
}

.pagination .page-item.active .page-link,
.pagination .page-link:hover {
  background: #e9f1ff;
  border-color: #adc4e8;
  color: #1d3f6b;
}

.pagination .page-item.disabled .page-link {
  background: #f7f9fc;
  color: #8fa0b8;
}

.dashboard-unassigned-table td:nth-child(3),
.dashboard-latest-table td:nth-child(3),
.dashboard-latest-table td:nth-child(4) {
  white-space: nowrap;
}

@media (max-width: 992px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .app-sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-topbar {
    padding: 0.75rem 0.9rem;
  }

  .app-content-wrap {
    padding: 0.85rem 0.65rem 1rem;
  }

  .app-page-head {
    flex-direction: column;
    align-items: stretch;
  }
}

@keyframes app-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
