/* ==========================================================================
   Factura Digital RD - Enterprise Modern Design System (e-CF DGII)
   Fintech Dark Aesthetic - Inspired by modern design standards
   ========================================================================== */

:root {
  /* Color Palette - Deep Navy / Slate */
  --bg-canvas: #070b14;
  --bg-surface: #0d1527;
  --bg-card: #131c31;
  --bg-card-hover: #18233d;
  --bg-input: #0a0f1d;
  
  /* Borders & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-focus: #6366f1;
  
  /* Text */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  /* Primary / Brand */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  --primary-glow: rgba(99, 102, 241, 0.35);
  
  /* Status Colors */
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.3);
  
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.3);
  
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.3);
  
  --info: #06b6d4;
  --info-light: rgba(6, 182, 212, 0.12);
  --info-border: rgba(6, 182, 212, 0.3);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 14px -1px rgba(0, 0, 0, 0.35), 0 2px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.5), 0 4px 10px -2px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px -2px var(--primary-glow);
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 0.875rem;
  --radius-xl: 1.25rem;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-canvas);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.07) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-canvas);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Typography Helpers */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  line-height: 1.25;
}

h1 { font-size: 1.85rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p {
  color: var(--text-muted);
}

code, pre, .font-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Top Mobile Bar */
.mobile-topbar {
  display: none;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Sidebar */
.sidebar {
  width: 275px;
  min-width: 275px;
  max-width: 275px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 40;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  padding: 0.25rem 0.25rem 1.15rem 0.25rem !important;
  margin-bottom: 1rem !important;
  border-bottom: 1px solid var(--border-subtle) !important;
}

.logo-icon {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%) !important;
  border-radius: var(--radius-md) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.35) !important;
  color: white !important;
  flex-shrink: 0 !important;
}

.logo-icon svg {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  max-width: 20px !important;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.logo-subtitle {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
}

/* Environment indicator badge */
.env-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  padding: 0.3rem 0.65rem !important;
  background: rgba(6, 182, 212, 0.08) !important;
  border: 1px solid var(--info-border) !important;
  border-radius: var(--radius-full) !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  color: #38bdf8 !important;
  margin-bottom: 1.15rem !important;
  width: fit-content !important;
}

.env-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 2s infinite ease-in-out;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Navigation Links */
.nav-section-title {
  font-size: 0.68rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  font-weight: 700 !important;
  color: var(--text-dim) !important;
  padding: 0.5rem 0.5rem 0.25rem 0.5rem !important;
  margin: 0 !important;
}

.nav-link {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  padding: 0.6rem 0.85rem !important;
  color: var(--text-muted) !important;
  font-weight: 500 !important;
  font-size: 0.875rem !important;
  border-radius: var(--radius-md) !important;
  margin-bottom: 0.2rem !important;
  transition: var(--transition) !important;
  border: 1px solid transparent !important;
  text-decoration: none !important;
}

.nav-link svg {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  color: var(--text-dim) !important;
  transition: var(--transition) !important;
  flex-shrink: 0 !important;
  display: block !important;
}

.nav-link:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.05) !important;
}

.nav-link:hover svg {
  color: #818cf8 !important;
  transform: translateX(1px);
}

.nav-link.active {
  color: #ffffff !important;
  background: rgba(99, 102, 241, 0.15) !important;
  font-weight: 600 !important;
  border: 1px solid rgba(99, 102, 241, 0.35) !important;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.15) !important;
}

.nav-link.active svg {
  color: #818cf8 !important;
}

/* User Card in Sidebar */
.sidebar-footer {
  margin-top: auto;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border-subtle);
}

.user-profile-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #f87171;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-md);
  transition: var(--transition);
  text-decoration: none;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

/* Main Content Layout */
.main-content {
  flex: 1;
  padding: 2.25rem 2.5rem;
  max-width: 1600px;
  overflow-y: auto;
  min-height: 100vh;
}

/* Cards & Surfaces */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-medium);
}

.card-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}

/* KPI Cards Grid */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: linear-gradient(145deg, var(--bg-card) 0%, rgba(19, 28, 49, 0.8) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-medium);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--card-accent, var(--primary)), transparent);
  opacity: 0.8;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-icon {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  color: var(--card-accent, var(--primary));
  flex-shrink: 0;
}

.stat-icon svg {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  max-width: 20px !important;
}

.stat-value {
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
  line-height: 1.1;
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.775rem;
  margin-top: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.25;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-medium);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.09);
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background: #ef4444;
  color: white;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.775rem;
  border-radius: var(--radius-sm);
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

thead {
  background: rgba(10, 15, 29, 0.7);
  border-bottom: 1px solid var(--border-medium);
}

th {
  padding: 0.9rem 1.15rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

td {
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Badges & Status Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.badge-success {
  background-color: var(--success-light);
  color: #34d399;
  border: 1px solid var(--success-border);
}
.badge-success .badge-dot { background-color: #10b981; }

.badge-danger {
  background-color: var(--danger-light);
  color: #f87171;
  border: 1px solid var(--danger-border);
}
.badge-danger .badge-dot { background-color: #ef4444; }

.badge-warning {
  background-color: var(--warning-light);
  color: #fbbf24;
  border: 1px solid var(--warning-border);
}
.badge-warning .badge-dot { background-color: #f59e0b; }

.badge-info {
  background-color: var(--info-light);
  color: #38bdf8;
  border: 1px solid var(--info-border);
}
.badge-info .badge-dot { background-color: #06b6d4; }

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-input {
  width: 100%;
  padding: 0.7rem 0.95rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 0.9rem;
  transition: var(--transition);
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background-color: rgba(10, 15, 29, 0.95);
}

.form-input::placeholder {
  color: var(--text-dim);
}

select.form-input {
  cursor: pointer;
  background-color: var(--bg-input);
}

select.form-input option {
  background-color: #0d1527;
  color: white;
}

/* Utility Helpers */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-6 { margin-bottom: 2rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1.5rem; }

.w-full { width: 100%; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.775rem;
  font-family: 'JetBrains Mono', monospace;
}

/* Modals & Alerts */
.alert-box {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid transparent;
}

.alert-success {
  background: rgba(16, 185, 129, 0.08);
  border-color: var(--success-border);
  color: #a7f3d0;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--danger-border);
  color: #fca5a5;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--warning-border);
  color: #fde68a;
}

.alert-info {
  background: rgba(6, 182, 212, 0.08);
  border-color: var(--info-border);
  color: #bae6fd;
}

/* Step Header in Forms */
.form-step-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.15rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-light);
  border: 1px solid var(--primary);
  color: #818cf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Terminal Console for Logs */
.terminal-window {
  background: #040711;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  margin-top: 1rem;
}

.terminal-header {
  background: #0a0f1d;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-dot.red { background: #ef4444; }
.terminal-dot.yellow { background: #f59e0b; }
.terminal-dot.green { background: #10b981; }

.terminal-body {
  padding: 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.825rem;
  color: #38bdf8;
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.6;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.page-btn {
  padding: 0.45rem 0.9rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  font-weight: 500;
  transition: var(--transition);
}

.page-btn:hover:not(.disabled) {
  background: var(--primary-light);
  color: white;
  border-color: var(--primary);
}

.page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.page-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Login Page Specific */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: radial-gradient(circle at 50% 30%, rgba(99, 102, 241, 0.12) 0%, transparent 65%), var(--bg-canvas);
}

.login-box {
  width: 100%;
  max-width: 440px;
  background: rgba(19, 28, 49, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.7);
}

/* Responsive Media Queries */
@media (max-width: 992px) {
  .layout {
    flex-direction: column;
  }
  
  .mobile-topbar {
    display: flex;
  }
  
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    width: 280px;
    box-shadow: 20px 0 30px rgba(0, 0, 0, 0.5);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    padding: 1.5rem 1.25rem;
  }
  
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Filtros y Buscador de Facturas
   ========================================================================== */
.filter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.filter-card:hover {
  border-color: var(--border-medium);
}

.period-chips-wrapper {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.period-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  font-family: inherit;
}

.period-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--border-medium);
}

.period-chip.active {
  background: rgba(99, 102, 241, 0.18);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.5);
  font-weight: 600;
  box-shadow: 0 0 12px -2px rgba(99, 102, 241, 0.35);
}

.period-count {
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-full);
  padding: 0.1rem 0.45rem;
  font-size: 0.725rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text-dim);
}

.period-chip.active .period-count {
  background: rgba(99, 102, 241, 0.35);
  color: #ffffff;
}

.filter-controls-row {
  display: grid;
  grid-template-columns: minmax(220px, 2.2fr) minmax(130px, 1fr) minmax(150px, 1.2fr) auto auto;
  gap: 0.65rem;
  align-items: center;
}

@media (max-width: 992px) {
  .filter-controls-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 580px) {
  .filter-controls-row {
    grid-template-columns: 1fr;
  }
}

.custom-date-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(10, 15, 29, 0.65);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-medium);
  flex-wrap: wrap;
}

.btn-active-date {
  border-color: var(--primary) !important;
  color: #c7d2fe !important;
  background: var(--primary-light) !important;
}

.d-none {
  display: none !important;
}


