:root {
  --bg-primary: #F8FAFF;
  --text-primary: #0A1E2C;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;
  --primary-color: #3D7AFF;
  --accent-yellow: #FFD262;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(243, 244, 246, 1);
  --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-dropdown: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Google Sans Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.625;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1.2;
}

/* Navigation Bar */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(243, 244, 246, 0.8);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-soft);
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 40px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-brand svg {
  color: var(--primary-color);
}

.nav-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
}

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 3rem 40px;
}

/* Upload Section */
.upload-section {
  margin-bottom: 3rem;
}

.glass-container {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-family: 'Inter', sans-serif;
}

/* Dropzone */
.dropzone {
  border: 2px dashed rgba(61, 122, 255, 0.3);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.5);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.dropzone:hover {
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.8);
}

.dropzone.dz-drag-hover {
  border-color: var(--primary-color);
  background: rgba(239, 246, 255, 0.5);
  transform: scale(1.01);
}

.dz-message {
  margin: 0;
}

.dz-message svg {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.dz-message h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-family: 'Inter', sans-serif;
}

.dz-message p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.file-info {
  display: inline-block;
  font-size: 0.875rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.8);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
}

/* Upload Queue */
.upload-queue {
  margin-top: 1.5rem;
}

.upload-item {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s ease;
}

.upload-item:hover {
  box-shadow: var(--shadow-soft);
  background: rgba(255, 255, 255, 1);
}

.upload-item-icon {
  font-size: 2rem;
}

.upload-item-info {
  flex: 1;
}

.upload-item-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.upload-item-size {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.upload-item-progress {
  width: 100%;
  height: 4px;
  background: rgba(61, 122, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.upload-item-progress-bar {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.upload-item-status {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.status-uploading {
  background: rgba(61, 122, 255, 0.1);
  color: #1e40af;
}

.status-success {
  background: rgba(16, 185, 129, 0.1);
  color: #065f46;
}

.status-error {
  background: rgba(239, 68, 68, 0.1);
  color: #991b1b;
}

/* Info Cards */
.info-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.info-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  transition: all 0.3s ease;
}

.info-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-dropdown);
}

.info-card-icon {
  width: 48px;
  height: 48px;
  background: rgba(61, 122, 255, 0.1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.info-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-family: 'Inter', sans-serif;
}

.info-card-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Table Section */
.table-section {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 4rem;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.table-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
}

.table-actions {
  display: flex;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Google Sans Flex', sans-serif;
}

.btn-secondary {
  background: rgba(61, 122, 255, 0.08);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(61, 122, 255, 0.15);
}

.btn-export {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(61, 122, 255, 0.2);
}

.btn-export:hover {
  background: #2563eb;
  box-shadow: 0 6px 8px -1px rgba(61, 122, 255, 0.3);
}

/* Table */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
  height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
  background: rgba(61, 122, 255, 0.05);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(61, 122, 255, 0.2);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: rgba(61, 122, 255, 0.3);
}

.invoices-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.invoices-table th {
  background: rgba(61, 122, 255, 0.05);
  color: var(--text-secondary);
  font-weight: 700;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid rgba(61, 122, 255, 0.1);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

.invoices-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(243, 244, 246, 1);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.invoices-table tbody tr {
  transition: background 0.2s ease;
  cursor: pointer;
}

.invoices-table tbody tr:hover {
  background: rgba(61, 122, 255, 0.03);
}

.invoices-table tbody tr.expanded {
  background: rgba(61, 122, 255, 0.05);
}

.checkbox-col {
  width: 40px;
}

.checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.empty-state {
  cursor: default !important;
}

.empty-state:hover {
  background: transparent !important;
}

.empty-message {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-message p {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Invoice Details (Expandable) */
.invoice-details {
  background: rgba(248, 250, 255, 0.5);
  border-top: 1px solid rgba(243, 244, 246, 1);
}

.invoice-details td {
  padding: 1.5rem !important;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .details-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.detail-section {
  background: rgba(255, 255, 255, 0.8);
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(243, 244, 246, 1);
}

.detail-section h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'Inter', sans-serif;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(243, 244, 246, 0.6);
  font-size: 0.875rem;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--text-secondary);
  font-weight: 500;
  flex-shrink: 0;
  min-width: 100px;
}

.detail-value {
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  overflow-wrap: break-word;
  hyphens: auto;
}

.detail-summary-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  overflow-wrap: break-word;
  hyphens: auto;
}

.detail-section-empty {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* Status Badge */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
}

.badge-processing {
  background: rgba(61, 122, 255, 0.1);
  color: #1e40af;
}

.badge-processed {
  background: rgba(16, 185, 129, 0.1);
  color: #065f46;
}

.badge-error {
  background: rgba(239, 68, 68, 0.1);
  color: #991b1b;
}

/* Footer */
.footer {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(243, 244, 246, 0.8);
  padding: 3rem 0;
  margin-top: 4rem;
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 40px;
}

.footer-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'Inter', sans-serif;
}

.footer-content {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.footer-content p {
  margin-bottom: 1rem;
}

.footer-list {
  list-style: none;
  margin: 1rem 0;
}

.footer-list li {
  margin-bottom: 0.75rem;
  padding-left: 1rem;
  position: relative;
}

.footer-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.footer-disclaimer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(243, 244, 246, 1);
  font-weight: 700;
  color: var(--text-primary);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(243, 244, 246, 1);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-dropdown);
  min-width: 300px;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-success {
  border-left: 4px solid var(--success-color);
}

.toast-error {
  border-left: 4px solid var(--error-color);
}

.toast-warning {
  border-left: 4px solid var(--warning-color);
}

.toast-icon {
  font-size: 1.5rem;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
}

.toast-message {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Responsive */

/* Large Desktop (1440px+) */
@media (min-width: 1440px) {
  .nav-container,
  .container,
  .footer-container {
    padding-left: 60px;
    padding-right: 60px;
  }
}

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
  .nav-container,
  .container,
  .footer-container {
    padding-left: 24px;
    padding-right: 24px;
  }

  .container {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .glass-container,
  .table-section {
    padding: 1.5rem;
  }

  .info-cards {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }

  .details-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .invoices-table {
    min-width: 700px;
  }
}

/* Medium Tablet Portrait (768px - 900px) */
@media (max-width: 900px) and (min-width: 768px) {
  .info-cards {
    grid-template-columns: 1fr;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
  body {
    padding: 0;
  }

  .nav-container,
  .container,
  .footer-container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .container {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }

  .glass-container,
  .table-section {
    padding: 1.25rem 1rem;
  }

  .section-title {
    font-size: 1.125rem;
  }

  .info-cards {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .info-card {
    padding: 1.25rem;
  }

  .table-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .table-header h2 {
    font-size: 1.25rem;
  }

  .table-actions {
    width: 100%;
    flex-direction: column;
  }

  .table-actions .btn {
    width: 100%;
    justify-content: center;
    font-size: 0.8125rem;
    padding: 0.625rem 1rem;
  }

  .invoices-table {
    font-size: 0.75rem;
  }

  .invoices-table th,
  .invoices-table td {
    padding: 0.625rem 0.5rem;
  }

  .invoices-table th {
    font-size: 0.6875rem;
  }

  .checkbox {
    width: 16px;
    height: 16px;
  }

  .badge {
    font-size: 0.6875rem;
    padding: 0.2rem 0.5rem;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    top: 0.5rem;
  }

  .toast {
    min-width: auto;
    padding: 0.875rem 1rem;
  }

  .details-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .detail-section {
    padding: 0.875rem;
  }

  .footer {
    padding: 2rem 16px;
  }

  .footer-title {
    font-size: 0.8125rem;
  }

  .footer-content {
    font-size: 11px;
  }

  .dropzone {
    padding: 2rem 1rem;
  }

  .dz-message h3 {
    font-size: 1rem;
  }

  .dz-message p {
    font-size: 0.875rem;
  }

  .upload-item {
    padding: 0.875rem;
    gap: 0.75rem;
  }

  .upload-item-icon {
    font-size: 1.5rem;
  }
}

/* Small Mobile (< 480px) */
@media (max-width: 480px) {
  .nav-title {
    font-size: 1rem;
  }

  .nav-brand svg {
    width: 28px;
    height: 28px;
  }

  .info-card-icon {
    width: 40px;
    height: 40px;
  }

  .info-card-icon svg {
    width: 20px;
    height: 20px;
  }
}

/* ========================================
   PASSWORD PROTECTION OVERLAY
   ======================================== */

.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  animation: fadeIn 0.3s ease-in-out;
}

.auth-overlay.hidden {
  display: none;
}

.auth-container {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  padding: 3rem 2.5rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
  animation: slideUp 0.4s ease-out;
}

.auth-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary-color), #667eea);
  border-radius: 50%;
  margin-bottom: 1.5rem;
  color: white;
}

.auth-title {
  font-size: 1.75rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.auth-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.auth-form {
  margin-bottom: 1.5rem;
}

.auth-input {
  width: 100%;
  padding: 1rem 1.25rem;
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s ease;
  background: white;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.auth-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(61, 122, 255, 0.1);
}

.auth-input::placeholder {
  color: var(--text-muted);
}

.auth-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error-color);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(239, 68, 68, 0.2);
  animation: shake 0.3s ease-in-out;
}

.auth-button {
  width: 100%;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--primary-color), #667eea);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.auth-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(61, 122, 255, 0.3);
}

.auth-button:active {
  transform: translateY(0);
}

.auth-footer {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 1.5rem;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

/* Responsive */
@media (max-width: 480px) {
  .auth-container {
    padding: 2rem 1.5rem;
  }

  .auth-title {
    font-size: 1.5rem;
  }

  .auth-icon {
    width: 64px;
    height: 64px;
  }

  .auth-icon svg {
    width: 48px;
    height: 48px;
  }
}
