@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700&family=Space+Grotesk:wght@500;700&display=swap');
:root {
  --bg-primary: #1a1528;
  --bg-secondary: #12101c;
  --bg-card: #1f1a30;
  --bg-card-hover: #261f3a;
  --bg-input: #16122a;
  --bg-tertiary: #221c35;
  --border: #2d2647;
  --border-hover: #3d3560;
  --border-focus: #6a5fc1;
  --text-primary: #f0eef5;
  --text-secondary: #b8b0cc;
  --text-muted: #706790;
  --accent: #6a5fc1;
  --accent-hover: #7d73d4;
  --accent-dim: rgba(106, 95, 193, 0.15);
  --accent-border: rgba(106, 95, 193, 0.35);
  --btn-purple: #79628c;
  --btn-purple-border: #584674;
  --success: #c2ef4e;
  --success-dim: rgba(194, 239, 78, 0.12);
  --warning: #ffb287;
  --warning-dim: rgba(255, 178, 135, 0.12);
  --danger: #fa7faa;
  --danger-dim: rgba(250, 127, 170, 0.12);
  --danger-hover: #e05a88;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-btn: 10px;
  --shadow: 0 4px 20px rgba(22, 15, 36, 0.6);
  --shadow-accent: 0 4px 20px rgba(106, 95, 193, 0.2);
  --shadow-inset: inset 0 1px 3px rgba(0, 0, 0, 0.15);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.18);
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(18px) saturate(180%);
  --gradient: linear-gradient(135deg, #6a5fc1 0%, #79628c 100%);
  --gradient-lime: linear-gradient(135deg, #c2ef4e 0%, #a8d946 100%);
  --transition: 0.2s ease;
}
*,
*:before,
*:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family:
    Rubik,
    -apple-system,
    system-ui,
    Segoe UI,
    Helvetica,
    Arial,
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
.app-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 230px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  z-index: 100;
}
.sidebar-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  padding: 0 10px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--gradient);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.sidebar-link:hover {
  background: var(--bg-card);
  color: var(--text-secondary);
}
.sidebar-link.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent-border);
}
.sidebar-link .icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-link .icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}
.main-content {
  flex: 1;
  margin-left: 230px;
  padding: 28px 32px;
  min-height: 100vh;
}
.page-header {
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
  color: var(--text-primary);
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  transition: all var(--transition);
  overflow: hidden;
}
.stat-card:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity var(--transition);
}
.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-card:hover:before {
  opacity: 1;
}
.stat-card .label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.stat-card .value.accent {
  color: var(--accent);
}
.stat-card .value.danger {
  color: var(--danger);
}
.stat-card .value.success {
  color: var(--success);
}
.stat-card .sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
}
.section-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead {
  background: var(--bg-secondary);
}
th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: var(--bg-card-hover);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.badge-success {
  background: var(--success-dim);
  color: var(--success);
}
.badge-danger {
  background: var(--danger-dim);
  color: var(--danger);
}
.badge-warning {
  background: var(--warning-dim);
  color: var(--warning);
}
.badge-info {
  background: var(--accent-dim);
  color: var(--accent);
}
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--btn-purple-border);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-primary {
  background: var(--btn-purple);
  color: #fff;
  border-color: var(--btn-purple-border);
  box-shadow: var(--shadow-inset);
}
.btn-primary:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
  background: #8a73a0;
}
.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: #fa7faa33;
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 11px;
}
.btn-ghost {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  border-color: var(--border-hover);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
input,
select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
input::placeholder {
  color: var(--text-muted);
}
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23706790' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.modal-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #0a0812d9;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.15s;
}
.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  animation: slideUp 0.2s;
}
.modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
}
.modal .field {
  margin-bottom: 16px;
}
.modal .field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.modal .field input,
.modal .field select {
  width: 100%;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar input,
.toolbar select {
  max-width: 180px;
}
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 16px;
}
.pagination button {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.pagination button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.pagination button:disabled {
  opacity: 0.3;
  cursor: default;
}
.pagination span {
  color: var(--text-muted);
  font-size: 13px;
}
.progress-bar {
  background: var(--bg-secondary);
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.4s;
}
.progress-fill.accent {
  background: var(--gradient);
}
.progress-fill.danger {
  background: var(--danger);
}
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 48px;
  color: var(--text-muted);
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent-dim);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin-right: 10px;
  animation: spin 0.8s linear infinite;
}
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  background-image:
    radial-gradient(
      ellipse at 30% 20%,
      rgba(106, 95, 193, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse at 70% 80%,
      rgba(122, 98, 140, 0.06) 0%,
      transparent 50%
    );
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  animation: slideUp 0.3s;
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: 0 20px 60px #0a081280;
}
.login-logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.login-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.login-error {
  font-size: 13px;
  color: var(--danger);
  margin-bottom: 10px;
}
code {
  font-family:
    Monaco,
    Menlo,
    Ubuntu Mono,
    monospace;
  font-size: 13px;
  color: var(--accent);
}
.health-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.health-dot.ok {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}
.health-dot.error {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}
.btn-killswitch {
  min-width: 200px;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 20px;
}
.btn-killswitch.active {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: #fa7faa4d;
  box-shadow: 0 0 20px #fa7faa26;
}
.btn-killswitch.inactive {
  background: var(--success-dim);
  color: var(--success);
  border-color: #c2ef4e4d;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}
::selection {
  background: var(--accent);
  color: #fff;
}



:root {

  --bg-primary: #1f1633;
  --bg-secondary: #150f23;
  --bg-card: #221a36; /* slightly lighter than primary for cards */
  --bg-card-hover: #2d2446;
  --bg-input: #ffffff;
  --bg-tertiary: #362d59;
  --border: #362d59; /* border purple */
  --border-hover: #584674;
  --border-focus: #ffb287;
  --text-primary: #ffffff;
  --text-secondary: #e5e7eb;
  --text-muted: #cfcfdb;
  --accent: #6a5fc1;
  --accent-hover: #79628c;
  --accent-dim: rgba(106, 95, 193, 0.15);
  --accent-border: rgba(106, 95, 193, 0.35);
  --btn-purple: #79628c;
  --btn-purple-border: #584674;
  --success: #c2ef4e; /* lime green */
  --success-dim: rgba(194, 239, 78, 0.12);
  --warning: #ffb287; /* coral */
  --warning-dim: rgba(255, 178, 135, 0.12);
  --danger: #fa7faa;
  --danger-dim: rgba(250, 127, 170, 0.12);
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-accent: 0 4px 4px 9px rgba(22, 15, 36, 0.9);
  --shadow-inset: inset 0 1px 3px 0px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.18);
  --glass-bg: rgba(255, 255, 255, 0.18);
  --glass-border: rgba(255, 255, 255, 0.08);
  --gradient: linear-gradient(135deg, #6a5fc1 0%, #422082 100%);
  --gradient-lime: linear-gradient(135deg, #c2ef4e 0%, #a8d946 100%);

}

/* Typography Overrides */
body {
    font-family: 'Rubik', -apple-system, system-ui, Segoe UI, Helvetica, Arial, sans-serif !important;
}

h1, h2, h3, .metric-value, .sidebar-logo, .hero-metric, .text-3xl, .text-4xl, .stat-value {
    font-family: 'Space Grotesk', 'Dammit Sans', sans-serif !important;
    font-weight: 700 !important;
    letter-spacing: -0.5px !important;
}

/* Component Overrides from DESIGN.md */
button, .btn, .badge, .status-badge, th, .sidebar-nav a {
    text-transform: uppercase !important;
    letter-spacing: 0.2px !important;
}

button, .btn {
    border-radius: 13px !important;
    font-weight: 700 !important;
    box-shadow: var(--shadow-inset) !important;
    transition: all 0.2s ease !important;
}

button:hover, .btn:hover {
    box-shadow: var(--shadow-hover) !important;
    transform: translateY(-1px);
}

.card, .panel, .overview-card, .chart-container, .table-container {
    background: rgba(255, 255, 255, 0.03) !important; /* frosted dark base */
    backdrop-filter: blur(18px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(18px) saturate(180%) !important;
    box-shadow: var(--shadow) !important;
    border-radius: 12px !important;
    border: 1px solid var(--border) !important;
    position: relative;
    overflow: hidden;
}

/* Ambient Purple Glow around major containers like Dashboard wraps */
.main-content {
    box-shadow: var(--shadow-accent) !important;
    background-color: var(--bg-primary) !important;
}

/* Lime green specific highlight overrides */
.badge.success, .status.success, .metric-positive {
    color: #1f1633 !important;
    background-color: var(--success) !important;
    font-weight: 700 !important;
}

/* Input Fields */
input, select, textarea, .form-control {
    background: var(--bg-tertiary) !important;
    border-radius: 6px !important;
    color: var(--text-primary) !important;
}

/* Link transitions */
a:hover {
    color: var(--accent) !important;
}



/* --- 2026 DESIGN ENHANCEMENTS V3 --- */

/* 1 & 2. Dynamic Aura Gradients + Noise Texture Overlay */
body::before, body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
}

/* Aura Gradients */
@keyframes auraAnimation {
    0% { background-position: 0% 50%, 100% 0%; }
    50% { background-position: 100% 50%, 0% 100%; }
    100% { background-position: 0% 50%, 100% 0%; }
}

body::before {
    background-image: 
        radial-gradient(circle at top left, rgba(66, 32, 130, 0.45) 0%, transparent 40%),
        radial-gradient(circle at bottom right, rgba(106, 95, 193, 0.3) 0%, transparent 50%);
    background-size: 200% 200%;
    animation: auraAnimation 25s ease-in-out infinite;
    z-index: -2;
}



/* 3. Glassmorphism 3.0: Specular Highlights */
/* Modifying the cards we previously styled to add top inner white glow */
.card, .panel, .overview-card, .chart-container, .table-container, .glass-panel {
    /* Overlaying a spec light above our standard shadow */
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

/* 4 & 5. Glowing Borders & Spring Animation */
button, .btn, .card, .panel {
    /* Using cubic-bezier for a spring effect / physical bounce */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.card:hover, .panel:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 14px 20px -5px rgba(106, 95, 193, 0.25) !important;
    border-color: rgba(106, 95, 193, 0.5) !important;
}

button:hover, .btn:hover {
    transform: scale(1.03) translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0.5rem 1.5rem rgba(194, 239, 78, 0.15) !important;
}

/* Special treatments */
::-webkit-scrollbar {
    width: 10px;
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(106, 95, 193, 0.5); /* Sentry purple scroller */
}



/* --- SMOOTHING FIX --- */
* {
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
}

body {
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
}

/* Fix backdrop-filter killing subpixel antialiasing */
.card, .panel, .overview-card, .chart-container, .table-container {
    transform: translateZ(0); /* Hardware acceleration fix for blurry text */
}



/* --- BADGE READABILITY FIX --- */
.badge, .status, td span, .status-badge {
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px !important;
    padding: 4px 8px !important;
    display: inline-block !important;
    line-height: 1 !important;
    border-radius: 6px !important;
    text-transform: uppercase !important;
    -webkit-font-smoothing: antialiased !important;
}

/* Green (Success) badges specific fix */
.badge.success, .status.success, .metric-positive, span:contains('FULFILLED'), td nobr span {
    background-color: var(--success) !important;
    color: #1f1633 !important; /* Dark purple text inside bright green */
    border: none !important;
    box-shadow: none !important;
}

/* --- CUSTOM LOGO INJECTION --- */
.sidebar-logo .logo-icon {
    display: none !important; /* Hide old generic box and icon completely */
}

.sidebar-logo {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.sidebar-logo::before {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    background-image: url('/assets/fuckmax-logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 6px;
    box-shadow: 0 0 15px rgba(194, 239, 78, 0.4); /* subtle lime glow */
}
