:root {
  --bg: #0a0e17;
  --card: rgba(255, 255, 255, 0.05);
  --card2: rgba(255, 255, 255, 0.08);
  --card-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.1);
  --text: rgba(255, 255, 255, 0.95);
  --muted: rgba(255, 255, 255, 0.72);
  --muted2: rgba(255, 255, 255, 0.50);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --radius: 16px;
  --radius2: 20px;
  --focus: 0 0 0 3px rgba(88, 101, 242, 0.3);
  --primary: linear-gradient(135deg, rgba(88, 101, 242, 0.95), rgba(16, 185, 129, 0.85));
  --primary-hover: linear-gradient(135deg, rgba(88, 101, 242, 1), rgba(16, 185, 129, 0.95));
  --success: rgba(34, 197, 94, 0.15);
  --success-border: rgba(34, 197, 94, 0.4);
  --error: rgba(239, 68, 68, 0.15);
  --error-border: rgba(239, 68, 68, 0.4);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 18% 8%, rgba(88, 101, 242, 0.20), transparent 60%),
    radial-gradient(1000px 700px at 88% 18%, rgba(16, 185, 129, 0.16), transparent 60%),
    radial-gradient(900px 600px at 50% 95%, rgba(236, 72, 153, 0.10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

a.underline {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  color: var(--muted);
}

a.underline:hover {
  color: var(--text);
  text-decoration-thickness: 2px;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px;
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0 20px;
  margin-bottom: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.2s ease;
}

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

.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.6), rgba(16, 185, 129, 0.4));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.logo::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: rotate(45deg);
  animation: logoShine 3s infinite;
}

@keyframes logoShine {
  0%, 100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.brand h1 {
  font-size: 17px;
  margin: 0;
  letter-spacing: 0.3px;
  font-weight: 650;
}

.brand p {
  margin: 0;
  font-size: 12px;
  color: var(--muted2);
  letter-spacing: 0.2px;
}

.navlinks {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

/* Buttons */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 12px 20px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 550;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

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

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.btn.primary {
  background: var(--primary);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-weight: 600;
}

.btn.primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 8px 25px rgba(88, 101, 242, 0.35);
}

/* Hero Section */
.hero {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 20px;
  padding: 32px 0 16px;
}

@media (max-width: 920px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    rgba(88, 101, 242, 0.5), 
    rgba(16, 185, 129, 0.5), 
    rgba(236, 72, 153, 0.5));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover::before {
  opacity: 1;
}

.card.pad {
  padding: 26px;
}

.card:hover {
  background: var(--card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 30px;
  letter-spacing: -0.5px;
  font-weight: 700;
  line-height: 1.2;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 20px;
  letter-spacing: -0.3px;
  font-weight: 650;
}

.card p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.65;
}

/* Image container for cards */
.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: calc(var(--radius2) - 1px) calc(var(--radius2) - 1px) 0 0;
  margin: -1px -1px 20px -1px;
  border: 1px solid var(--border);
}

.card-image-wrapper {
  position: relative;
  overflow: hidden;
  margin: -26px -26px 20px -26px;
  border-radius: var(--radius2) var(--radius2) 0 0;
}

.card-image-wrapper::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to top, rgba(10, 14, 23, 0.9), transparent);
  pointer-events: none;
}

.card-image-wrapper img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card:hover .card-image-wrapper img {
  transform: scale(1.05);
}

/* KPIs */
.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

@media (max-width: 620px) {
  .kpis {
    grid-template-columns: 1fr;
  }
}

.kpi {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(88, 101, 242, 0.5), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.kpi:hover::before {
  opacity: 1;
}

.kpi:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.kpi .big {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.kpi .small {
  font-size: 13px;
  color: var(--muted2);
  margin-top: 6px;
  line-height: 1.4;
}

/* Grid */
.grid3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

@media (max-width: 920px) {
  .grid3 {
    grid-template-columns: 1fr;
  }
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: 0.2px;
}

/* Section */
.section {
  padding: 20px 0 32px;
}

.section h3 {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
  color: var(--muted2);
  line-height: 1.5;
}

/* Forms */
.form {
  display: grid;
  gap: 16px;
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 620px) {
  .row2 {
    grid-template-columns: 1fr;
  }
}

label {
  font-size: 13px;
  color: var(--muted2);
  display: block;
  margin: 0 0 8px;
  font-weight: 550;
  letter-spacing: 0.2px;
}

input, select, textarea {
  width: 100%;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  outline: none;
  font-size: 14px;
  transition: all 0.2s ease;
  font-family: inherit;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted2);
  opacity: 0.6;
}

textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}

input:focus, select:focus, textarea:focus {
  box-shadow: var(--focus);
  border-color: rgba(88, 101, 242, 0.5);
  background: rgba(0, 0, 0, 0.3);
}

input:hover, select:hover, textarea:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

/* Inline Error */
.inlineError {
  display: none;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--error-border);
  background: var(--error);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.inlineError.show {
  display: block;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* HR */
.hr {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  border: 0;
  margin: 18px 0;
}

/* Footer */
.footer {
  padding: 28px 0 36px;
  color: var(--muted2);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 40px;
}

/* Toasts */
.toasts {
  position: fixed;
  top: 24px;
  right: 24px;
  display: grid;
  gap: 12px;
  z-index: 9999;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(10, 14, 23, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  padding: 16px;
  pointer-events: all;
  animation: toastSlideIn 0.3s ease;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast .tTitle {
  font-weight: 650;
  margin-bottom: 5px;
  font-size: 15px;
}

.toast .tMsg {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.toast .tRow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.toast button {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toast button:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Admin Split Layout */
.split {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 980px) {
  .split {
    grid-template-columns: 1fr;
  }
}

/* Panel with Hover Effect */
.panel {
  position: relative;
  transition: all 0.2s ease;
}

.panel:hover, .panel:focus-within {
  z-index: 10;
  transform: translateY(-3px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
}

/* Table */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table th {
  text-align: left;
  font-size: 13px;
  color: var(--muted2);
  font-weight: 650;
  padding: 8px 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-size: 11px;
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
}

.table th.sortable:hover {
  text-decoration: underline;
}

.table td {
  padding: 14px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}

.table td:first-child {
  border-left: 1px solid var(--border);
  border-radius: 12px 0 0 12px;
}

.table td:last-child {
  border-right: 1px solid var(--border);
  border-radius: 0 12px 12px 0;
}

.table tr {
  transition: all 0.2s ease;
}

.table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Chip */
.chip {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  color: var(--muted);
  font-weight: 550;
  letter-spacing: 0.3px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Loading State */
.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Accessibility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid rgba(88, 101, 242, 0.6);
  outline-offset: 2px;
}

/* Responsive improvements */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .navlinks {
    width: 100%;
    justify-content: flex-start;
  }

  .card h2 {
    font-size: 26px;
  }

  .toasts {
    top: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
  }
}