:root {
  --bg: #030712;
  /* Deeper black */
  --surface: rgba(17, 24, 39, 0.7);
  --surface-2: #111827;
  --text: #f9fafb;
  --text-muted: #9ca3af;
  --brand: #10b981;
  /* Precise Emerald */
  --brand-2: #3b82f6;
  /* Precise Blue */
  --accent: #8b5cf6;
  /* Precise Violet */
  --danger: #ef4444;
  --card: rgba(17, 24, 39, 0.8);
  --border: rgba(255, 255, 255, 0.06);
  --shadow-1: 0 20px 50px rgba(0, 0, 0, 0.5);
  --radius: 20px;
  --container: 1240px;
  --gradient-1: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  --gradient-2: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 5% 5%, rgba(16, 185, 129, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 95% 95%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: var(--container);
  padding: 0 24px;
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 8px 0;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.brand i {
  color: var(--brand);
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav a {
  color: #94a3b8;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav a:hover,
.nav a.active {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.nav a i {
  color: var(--brand);
  font-size: 1.05rem;
}

main {
  padding: 40px 0 80px;
  animation: fadeIn 0.6s ease-out;
}

.card:not(.modal-content) {
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-1);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  overflow: hidden;
}

.card:not(.modal-content):hover {
  transform: translateY(-6px);
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 0 0 20px rgba(16, 185, 129, 0.1);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.02em;
}

h1 {
  margin: 0 0 32px;
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  display: flex;
  align-items: center;
  gap: 15px;
}

h2 {
  margin: 0 0 20px;
  font-size: 1.6rem;
  color: var(--brand);
}

.card-title {
  color: #fff !important;
  font-weight: 800 !important;
}

.muted {
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  font-weight: 700;
  border-radius: 14px;
  padding: 10px 24px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  font-size: 0.88rem;
  gap: 8px;
}

.btn.primary {
  background: var(--gradient-1);
  color: #000 !important;
  box-shadow: 0 4px 15px rgba(6, 214, 160, 0.3);
  border: none;
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(6, 214, 160, 0.4);
  filter: brightness(1.1);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  color: var(--text);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--brand-2);
  color: var(--brand-2);
}

.btn.danger {
  background: rgba(255, 77, 77, 0.1);
  border-color: rgba(255, 77, 77, 0.2);
  color: #ff9999;
}

.btn.danger:hover {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 8px 20px rgba(255, 77, 77, 0.3);
}

/* Outline Buttons */
.btn-outline-primary {
  border: 2px solid var(--brand-2) !important;
  color: var(--brand-2) !important;
  background: transparent;
}

.btn-outline-primary:hover {
  background: var(--brand-2) !important;
  color: #fff !important;
}

.btn-outline-success {
  border: 2px solid var(--brand) !important;
  color: var(--brand) !important;
  background: transparent;
}

.btn-outline-success:hover {
  background: var(--brand) !important;
  color: #000 !important;
}

.btn-outline-secondary {
  border: 2px solid #aeb9cc !important;
  color: #aeb9cc !important;
  background: transparent;
}

.btn-outline-secondary:hover {
  background: #aeb9cc !important;
  color: #000 !important;
}

.btn.small {
  padding: 6px 16px;
  font-size: 0.8rem;
  border-radius: 10px;
}

.form-control,
input,
select,
textarea {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--border) !important;
  background: rgba(255, 255, 255, 0.03) !important;
  color: #fff !important;
  outline: none;
  transition: all 0.3s ease;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand) !important;
  background: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 0 20px rgba(6, 214, 160, 0.2) !important;
}

.btn-dark {
  background-color: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  color: #fff !important;
  padding: 10px 24px;
  border-radius: 14px;
  font-weight: 700;
  transition: all 0.3s ease;
}

.btn-dark:hover {
  background-color: var(--brand-2) !important;
  border-color: var(--brand-2) !important;
  transform: translateY(-2px);
}

label {
  display: block;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table th {
  padding: 12px 20px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.table td {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  transition: all 0.2s ease;
}

.table td:first-child {
  border-left: 1px solid var(--border);
  border-top-left-radius: 15px;
  border-bottom-left-radius: 15px;
}

.table td:last-child {
  border-right: 1px solid var(--border);
  border-top-right-radius: 15px;
  border-bottom-right-radius: 15px;
}

.table tr:hover td {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(6, 214, 160, 0.3);
}

.notice {
  background: rgba(6, 214, 160, 0.1);
  border: 1px solid rgba(6, 214, 160, 0.2);
  color: var(--brand);
  padding: 15px 25px;
  border-radius: 15px;
  margin-bottom: 25px;
  font-weight: 600;
}

.error {
  background: rgba(255, 77, 77, 0.1);
  border: 1px solid rgba(255, 77, 77, 0.2);
  color: #ff9999;
  padding: 15px 25px;
  border-radius: 15px;
  margin-bottom: 25px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.row-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--surface-2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Bootstrap Overrides */
.modal-content {
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
}

.modal-header {
  border-bottom: 1px solid var(--border) !important;
}

.modal-footer {
  border-top: 1px solid var(--border) !important;
}

.btn-close {
  filter: invert(1);
}

/* Visibility Overrides for Bootstrap Utilities in Dark Theme */
.text-muted {
  color: var(--text-muted) !important;
}

.text-primary {
  color: var(--brand-2) !important;
}

.text-success {
  color: var(--brand) !important;
}

.bg-primary.bg-opacity-10 {
  background-color: rgba(59, 130, 246, 0.1) !important;
}

.bg-success.bg-opacity-10 {
  background-color: rgba(16, 185, 129, 0.1) !important;
}

.bg-light {
  background-color: rgba(255, 255, 255, 0.04) !important;
}

.bg-white {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

/* Refined Utility Combos */
.badge {
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge.bg-primary {
  background: var(--brand-2) !important;
  color: #fff !important;
}

.badge.bg-success {
  background: var(--brand) !important;
  color: #000 !important;
}

.badge.bg-light {
  background: rgba(255, 255, 255, 0.1) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

.btn-light {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

.btn-light:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--brand) !important;
}

/* Specific component fixes */
.dashboard-card-highlight {
  border-left: 4px solid var(--brand);
}

.card-img-top.bg-light {
  background-color: var(--surface-2) !important;
}

.form-check-label.text-muted {
  color: var(--text-muted) !important;
}