:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
  --radius-lg: 16px;
  --radius-md: 10px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  background-color: var(--bg);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* Dynamic Background */
.blob-bg {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: float 20s infinite ease-in-out alternate;
}
.blob-1 { top: -10%; left: -10%; width: 50vw; height: 50vw; background: #c7d2fe; }
.blob-2 { bottom: -20%; right: -10%; width: 60vw; height: 60vw; background: #e0e7ff; animation-delay: -5s; }
.blob-3 { top: 40%; left: 30%; width: 40vw; height: 40vw; background: #ddd6fe; animation-delay: -10s; }

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(5%, 10%) scale(1.1); }
}

/* Layout */
.container {
  max-width: 1000px;
  margin: 40px auto 80px;
  padding: 0 20px;
}

/* Glass Panel Base */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
}

/* Header */
.top-header {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  align-items: center;
  padding: 24px;
  margin-bottom: 24px;
}
.branding {
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo-icon {
  width: 48px; height: 48px;
  background: rgba(79, 70, 229, 0.1);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.logo-icon svg { width: 24px; height: 24px; }
.branding h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.branding p { margin: 6px 0 0; font-size: 15px; color: var(--text-muted); }

.stats-group { display: flex; gap: 32px; }
.stat-item { display: flex; flex-direction: column; align-items: flex-end; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.stat-item strong { font-size: 18px; font-weight: 700; color: var(--primary); }

/* Controls */
.date-picker-wrapper {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 64px;
  border-radius: 16px;
  width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: var(--transition);
}
.date-picker-wrapper:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 16px rgba(31, 38, 135, 0.08);
}
.date-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-main);
  margin-right: 16px;
}
.date-label svg { width: 24px; height: 24px; color: var(--primary); }
.date-select {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 22px;
  font-family: inherit;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  padding-right: 44px;
  min-width: 0;
}
.date-select:focus { color: var(--primary-hover); }

.btn {
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  text-decoration: none;
  transition: all 0.3s ease;
}

/* Status Banner */
.status-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 32px;
  border-radius: 100px;
  width: fit-content;
  margin: 0 auto 24px auto;
  font-weight: 600;
  font-size: 16px;
  animation: fadeUp 0.4s ease-out;
}
.status-banner.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #059669;
}
.status-banner.success svg { color: #10b981; }

.status-banner.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #d97706;
}
.status-banner.warning svg { color: #f59e0b; }

.btn:hover {
  transform: translateY(-1px);
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  backdrop-filter: none;
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border-color: rgba(79, 70, 229, 0.2);
}
.btn-ghost:hover {
  background: rgba(79, 70, 229, 0.08);
  border-color: var(--primary);
}

/* Message Banner */
.message-banner {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  font-size: 14px;
  font-weight: 500;
  border-left: 4px solid var(--primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}
.pulse-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(79, 70, 229, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

.cards-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  align-items: start;
}
.file-card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.05);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.file-card-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}
.file-card-title {
  font-size: 16px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
.file-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}
.file-card-actions .btn {
  flex: 1;
  justify-content: center;
  padding: 0 8px;
  min-height: 40px;
}

@keyframes fadeUp {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}



.data-viewer {
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 20px 32px;
  margin: 0;
  height: 55vh;
  min-height: 300px;
  overflow-y: auto;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.02);
  white-space: pre-wrap;
  word-break: break-all;
  column-width: 100px;
  column-gap: 40px;
  column-rule: 1px solid rgba(0,0,0,0.04);
}

.data-viewer::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.data-viewer::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 10px;
}
.data-viewer::-webkit-scrollbar-thumb {
  background: rgba(79, 70, 229, 0.15);
  border-radius: 10px;
}
.data-viewer::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 70, 229, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
  body { padding: 12px; }
  .container { margin: 0 auto; padding: 0; }
  .top-header { padding: 16px; grid-template-columns: 1fr; gap: 14px; }
  .branding { gap: 12px; }
  .logo-icon { width: 42px; height: 42px; border-radius: 12px; }
  .logo-icon svg { width: 20px; height: 20px; }
  .branding h1 { font-size: 20px; }
  .branding p { font-size: 14px; line-height: 1.4; }
  .stats-group { width: 100%; justify-content: space-between; }
  .stat-item { align-items: flex-start; }
  .date-picker-wrapper {
    width: 100%;
    box-sizing: border-box;
    height: 56px;
    padding: 0 14px;
    border-radius: 14px;
  }
  .date-label {
    font-size: 16px;
    gap: 8px;
    margin-right: 8px;
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .date-label svg { width: 20px; height: 20px; }
  .date-select {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 18px;
    padding-right: 32px;
    background-size: 18px 18px;
    background-position: right 2px center;
    line-height: 1.2;
  }
  
  .cards-container {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .file-card {
    padding: 16px;
    gap: 14px;
  }
  .file-card-title {
    gap: 8px;
    align-items: center;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    width: 100%;
  }
  .file-card-title span {
    min-width: 0;
    font-size: 15px;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.25;
  }
  .data-count-box {
    flex: 0 0 auto;
    font-size: 12px !important;
    margin-left: 0 !important;
    justify-self: end;
    white-space: nowrap;
  }
  .file-card-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 6px;
  }
  .file-card-actions .btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 40px;
    padding: 0 4px;
    font-size: 13px;
    white-space: nowrap;
  }
  
  .status-banner {
    width: 100%;
    box-sizing: border-box;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 15px;
    margin-bottom: 16px;
    justify-content: flex-start;
  }
  .message-banner {
    margin-bottom: 16px;
    padding: 12px 14px;
    font-size: 13px;
  }

  .data-viewer {
    padding: 14px;
    height: 52vh;
    min-height: 220px;
    column-count: 1;
    column-width: auto;
    column-gap: 0;
    font-size: 12px;
    line-height: 1.6;
  }
}

@media (max-width: 420px) {
  body { padding: 10px; }
  .top-header { padding: 14px; }
  .branding h1 { font-size: 18px; }
  .date-picker-wrapper { height: 52px; padding: 0 12px; }
  .date-label { font-size: 15px; margin-right: 6px; }
  .date-label svg { width: 18px; height: 18px; }
  .date-select { font-size: 16px; padding-right: 26px; background-size: 16px 16px; }
  .file-card-actions .btn { font-size: 12px; }
}
