:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --border: #e2e8f0;
}

html {
  font-size: 15px;
  min-height: 100%;
}

body {
  color: var(--text);
  background: radial-gradient(circle at top right, #e0ecff, #f8fbff 38%, #f4f7fb 70%);
  min-height: 100vh;
}

.app-shell {
  max-width: 1280px;
}

.navbar-modern {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-top: 1rem;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1d4ed8, #60a5fa);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.nav-pill .nav-link {
  border-radius: 10px;
  color: #334155;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
}

.nav-pill .nav-link.active,
.nav-pill .nav-link:hover {
  background: var(--primary-soft);
  color: #1d4ed8;
}

.glass-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.section-title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.muted {
  color: var(--muted);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-color: #2563eb;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  border-color: #1d4ed8;
}

.form-control,
.form-select {
  border-radius: 12px;
  border-color: #d7e1ef;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.form-control:focus,
.form-select:focus,
.btn:focus {
  box-shadow: 0 0 0 0.18rem rgba(37, 99, 235, 0.2);
  border-color: #8bb7ff;
}

.table-modern {
  --bs-table-bg: transparent;
  margin-bottom: 0;
}

.table-modern thead th {
  color: #334155;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom-width: 1px;
  border-color: var(--border);
  padding: 0.9rem 0.85rem;
  background: #f8fafc;
}

.table-modern tbody td {
  border-color: #eef2f7;
  padding: 0.85rem;
  vertical-align: middle;
}

.table-modern tbody tr:hover {
  background: #f8fbff;
}

.page-footer {
  color: #64748b;
  padding: 1.1rem 0 2rem;
}

.auth-wrap {
  min-height: calc(100vh - 220px);
}

.auth-card {
  max-width: 430px;
}

/* Login page */
.login-root {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
}

.login-panel {
  width: 100%;
  max-width: 960px;
  border-radius: 24px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow:
    0 4px 6px -1px rgba(15, 23, 42, 0.06),
    0 24px 48px -12px rgba(37, 99, 235, 0.12);
}

.login-panel-grid {
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 992px) {
  .login-panel-grid {
    grid-template-columns: 1fr 1fr;
    min-height: 520px;
  }
}

.login-panel-brand {
  position: relative;
  color: #fff;
  padding: 2rem 1.75rem;
  overflow: hidden;
}

@media (min-width: 992px) {
  .login-panel-brand {
    padding: 2.75rem 2.25rem;
  }
}

.login-panel-brand-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120% 80% at 20% 20%, rgba(96, 165, 250, 0.45), transparent 50%),
    radial-gradient(ellipse 90% 70% at 90% 90%, rgba(14, 165, 233, 0.35), transparent 45%),
    linear-gradient(155deg, #172554 0%, #1d4ed8 42%, #0369a1 100%);
  z-index: 0;
}

.login-panel-brand-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.9;
}

.login-panel-brand-inner {
  position: relative;
  z-index: 1;
}

.login-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1rem;
}

.login-company-block {
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-company-logo {
  display: block;
  max-height: 56px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}

.login-company-name {
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.login-hero-title {
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.15);
}

.login-hero-sub {
  font-size: 0.95rem;
  line-height: 1.55;
  opacity: 0.88;
  margin-bottom: 1.75rem;
}

.login-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.88rem;
  line-height: 1.45;
  opacity: 0.92;
  margin-bottom: 0.85rem;
}

.login-feature-list li:last-child {
  margin-bottom: 0;
}

.login-feature-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.05rem;
}

.login-panel-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.75rem 2.25rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

@media (min-width: 992px) {
  .login-panel-form {
    padding: 2.75rem 2.5rem;
  }
}

.login-form-inner {
  width: 100%;
  max-width: 380px;
}

.login-form-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.35rem;
}

.login-form-hint {
  font-size: 0.9rem;
  margin-bottom: 0;
}

.login-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: #475569;
  margin-bottom: 0.35rem;
}

.login-input-wrap {
  position: relative;
}

.login-input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.login-input {
  padding-left: 2.65rem !important;
  border-radius: 14px !important;
  border: 1px solid #d7e1ef !important;
  background: #fff;
  font-size: 0.98rem;
  min-height: 48px;
}

.login-input:hover {
  border-color: #b9cceb !important;
}

.login-input:focus {
  background: #fff;
}

.login-submit {
  border-radius: 14px !important;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding-top: 0.75rem !important;
  padding-bottom: 0.75rem !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.login-submit:hover {
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.metric {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fbff;
}

/* Sidebar */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--card);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    height: 100vh;
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
}

@media (min-width: 992px) {
  .sidebar.offcanvas {
    position: relative !important;
    transform: none !important;
    visibility: visible !important;
    display: flex !important;
    flex-direction: column;
  }
  .sidebar.offcanvas.offcanvas-start {
    border-right: 1px solid var(--border);
  }
}

.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  color: inherit;
  text-decoration: none;
}

.sidebar-brand:hover {
  color: var(--primary);
}

.sidebar-nav {
  padding: 0.75rem 0;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-menu > li {
  margin: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 0.6rem 1.25rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.sidebar-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.sidebar-menu-group .sidebar-toggle-link {
  display: flex;
  justify-content: space-between;
}

.sidebar-menu-group .sidebar-toggle-link::after {
  content: "";
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s;
}

.sidebar-menu-group .sidebar-toggle-link[aria-expanded="true"]::after {
  transform: rotate(-135deg);
}

.sidebar-submenu {
  list-style: none;
  padding: 0;
  margin: 0;
  background: #f8fafc;
}

.sidebar-submenu li a {
  display: block;
  padding: 0.5rem 1.25rem 0.5rem 2rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.sidebar-submenu li a:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.sidebar-submenu li a.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.main-body {
  flex: 1;
  padding: 1.5rem 0;
}