    :root {
      --primary: #2563eb;
      --primary-dark: #1e40af;
      --primary-light: #60a5fa;
      --success: #10b981;
      --error: #ef4444;
      --neutral-50: #f8fafc;
      --neutral-100: #f1f5f9;
      --neutral-200: #e2e8f0;
      --neutral-700: #334155;
      --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
      --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
      --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
      font-size: 80%;
    }



    body {
      margin: 0;
      font-family: Inter, system-ui, -apple-system, sans-serif;
      display: flex;
      min-height: 100vh;
      color: var(--neutral-700);
      line-height: 1.5;
      padding-top: 70px; /* Add padding to body to avoid content going under fixed header */
      box-sizing: border-box;
    }

    /* --- Top Bar --- */
    header.top-bar {
  /* Solid ReconcileIQ Blue Theme */
  background: rgb(59, 130, 246); /* Solid blue background - no transparency */
  color: #fff;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: flex-start; /* Keep elements starting from left */
  padding: 0 1rem;
  box-shadow: 0 4px 30px rgba(59, 130, 246, 0.1);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  z-index: 10000;
  /* Add subtle gradient overlay */
  overflow: hidden;
}

    header.top-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(37, 99, 235, 0.18));
  pointer-events: none;
  z-index: -1;
}

    header.top-bar .brand {
      font-weight: 600;
      font-size: 1.5rem;
      white-space: nowrap;
      margin-right: 1rem; /* Adjusted margin */
    }

    header.top-bar nav.top-nav {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-left: auto;
  margin-right: auto; /* Center the nav section */
  padding-left: 60px; /* Offset to balance the logo on the left */
}

    header.top-bar nav.top-nav .nav-links {
      display: flex;
      gap: 0.5rem; /* Reduced gap */
      align-items: center;
    }

    header.top-bar nav.top-nav a {
      color: #fff;
      text-decoration: none;
      font-size: 0.9rem; /* Slightly smaller font */
      padding: 0.5rem 0.8rem; /* Adjusted padding */
      border-radius: 4px;
      transition: background 0.3s, transform 0.1s;
      white-space: nowrap; /* Prevent wrapping */
    }

    header.top-bar nav.top-nav a:hover {
      background: rgba(255,255,255,0.2);
    }

    header.top-bar nav.top-nav a:active {
      transform: scale(0.95);
    }


    /* Buy Credits Button Styling (overridden by editorial section below) */
    header.top-bar nav.top-nav a#buyCredits {
      background: rgba(255, 255, 255, 0.2);
      color: #fff;
      font-weight: 600;
      padding: 0.5rem 1rem;
      border-radius: 4px;
      border: 1px solid rgba(255, 255, 255, 0.4);
      box-shadow: none;
      transition: background 0.2s, transform 0.1s;
      margin-left: 0.5rem;
      position: relative;
      overflow: hidden;
    }
    header.top-bar nav.top-nav a#buyCredits:hover {
      background: rgba(255, 255, 255, 0.3);
      transform: none;
      box-shadow: none;
    }
    header.top-bar nav.top-nav a#buyCredits:active {
      transform: scale(0.98);
    }

    /* View Plans Button - Premium Gradient Styling */
    header.top-bar nav.top-nav a#upgradeButton {
      background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #f59e0b 100%);
      color: #fff;
      font-weight: 700;
      padding: 0.5rem 1.2rem;
      border-radius: 6px;
      border: none;
      box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      margin-left: 0.5rem;
      position: relative;
      overflow: hidden;
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }
    header.top-bar nav.top-nav a#upgradeButton:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
    }
    header.top-bar nav.top-nav a#upgradeButton:active {
      transform: translateY(0) scale(0.98);
    }

    /* Shine effect for buttons */
    #buyCredits span, #upgradeButton span {
      position: absolute;
      top: 0;
      left: -100%;
      width: 100%;
      height: 100%;
      background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
      transition: none;
      transform: skewX(-20deg);
    }

    header.top-bar nav.top-nav .nav-right-items {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-left: auto; /* Push Help, API, Settings to the right */
    }

    /* --- Mobile Menu Toggle (Burger) --- */
    .mobile-menu-toggle {
      display: none; /* Hidden by default */
      background: none;
      border: none;
      color: white;
      cursor: pointer;
      padding: 0.5rem;
      margin-left: 1rem; /* Space from other items if needed */
    }
    .mobile-menu-toggle i {
      width: 28px;
      height: 28px;
    }

    /* --- Sidebar Toggle --- */
    .sidebar-toggle {
    display: none; /* Hidden by default */
    position: fixed;
    top: 85px; /* FIX 1: Position below the 70px header + 15px padding */
    left: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--neutral-200);
    color: var(--primary-dark);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    z-index: 10001; /* Above sidebar overlay */
    box-shadow: var(--shadow);
    transition: background 0.2s;
}
     .sidebar-toggle:hover {
        background: var(--neutral-100);
    }
    .sidebar-toggle i {
      width: 24px;
      height: 24px;
      display: block; /* Prevents extra space below icon */
    }


    /* --- Responsive Styles --- */
    @media (max-width: 992px) { /* Adjust breakpoint as needed */
      /* Override overflow:hidden to allow mobile dropdown to show */
      header.top-bar {
        overflow: visible;
      }

      header.top-bar nav.top-nav .nav-links {
        display: none; /* Hide links container by default on mobile */
        position: absolute;
        top: 70px; /* Position below header */
        right: 0;
        background: linear-gradient(145deg, var(--primary), var(--primary-dark)); /* Match header gradient */
        box-shadow: var(--shadow-lg);
        border-radius: 0 0 8px 8px;
        width: 250px; /* Adjust width */
        flex-direction: column;
        align-items: stretch; /* Stretch links */
        padding: 1rem 0; /* Add padding */
        gap: 0; /* Remove gap, use padding/margin on links */
        z-index: 9999; /* Below header but above content */
        border-top: 1px solid rgba(255, 255, 255, 0.2);
      }

      header.top-bar nav.top-nav .nav-links.active {
        display: flex; /* Show when active */
        animation: fadeInDown 0.3s ease-out;
      }

      header.top-bar nav.top-nav .nav-links a {
          padding: 0.8rem 1.5rem; /* Increase padding for easier tapping */
          border-radius: 0; /* Remove individual radius */
          border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Separator */
          text-align: left;
          width: 100%;
          box-sizing: border-box;
      }
       header.top-bar nav.top-nav .nav-links a:last-child {
          border-bottom: none;
      }
       header.top-bar nav.top-nav .nav-links a:hover {
          background: rgba(255, 255, 255, 0.15);
       }

      .mobile-menu-toggle {
        display: block; /* Show burger on mobile */
      }

      .sidebar {
        position: fixed;
        left: -250px; /* Hide off-screen */
        top: 70px; /* Position below header */
        height: calc(100vh - 70px); /* Full height below header */
        width: 250px; /* Mobile width */
        z-index: 9998; /* Below mobile nav */
        transition: left 0.3s ease-in-out;
        margin-top: 0; /* Remove margin */
        border-right: 1px solid #dee2e6;
        background-color: #f8f9fa; /* Ensure background */
      }

      .sidebar.active {
        left: 0; /* Slide in */
      }

      .sidebar-toggle {
        display: block; /* Show sidebar toggle */
      }

      .main-content {
        margin-left: 0; /* Remove desktop margin */
        transition: margin-left 0.3s ease-in-out;
         padding: 10px; /* Reduce padding */
      }
      /* Optional: Push content when sidebar is active on mobile */
      /* body.sidebar-active .main-content {
        margin-left: 250px;
      } */

       /* Adjust loading overlay for mobile */
       #loadingOverlayFront {
          left: 0;
          width: 100%;
       }
       /* Adjust modal position for mobile */
       .modal-content {
           left: 50%;
           transform: translate(-50%, -50%);
       }
       .power-up-content {
           left: 50%;
           transform: translate(-50%, -50%) scale(0.9);
        }
         .power-up-overlay.active .power-up-content {
            transform: translate(-50%, -50%) scale(1);
        }
         #resultsNavigation {
             display: none; /* Hide results nav on smaller screens */
         }
    }

    @keyframes fadeInDown {
      from { opacity: 0; transform: translateY(-10px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* Loading overlays and other styles remain unchanged */
    #loadingOverlayBack {
      position: fixed;
      top: 0; left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0,0,0,0.25);
      display: none;
      z-index: 9998;
    }
    #loadingOverlayFront {
      position: fixed;
      top: 0;
      /* left: 200px; Adjusted dynamically */
      width: calc(100% - 200px); /* Default desktop width */
      height: 100%;
      pointer-events: none;
      display: none;
      z-index: 9999;
    }
    .spinner-center {
      position: absolute;
      top: 50%; left: 50%;
      transform: translate(-50%, -50%);
    }
    .spinner {
      width: 40px;
      height: 40px;
      border: 5px solid #ddd;
      border-top-color: var(--primary-dark);
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }
    @keyframes spin {
      0% { transform: rotate(0deg);}
      100% { transform: rotate(360deg);}
    }
    #successCheck {
      display: none;
      position: fixed;
      top: 50%;
      /* left: calc(50% + 100px); Adjusted dynamically */
      left: 50%; /* Default center */
      transform: translate(-50%, -50%);
      background: #fff;
      border: 3px solid var(--success);
      border-radius: 50%;
      padding: 1rem 1.5rem;
      box-shadow: var(--shadow-lg);
      z-index: 10001;
    }
     @media (min-width: 993px) { /* Desktop only adjustments */
         #loadingOverlayFront { left: 200px; width: calc(100% - 200px); }
         #successCheck { left: calc(50% + 100px); }
     }
    #successCheck::before {
      content: "✓";
      font-size: 2rem;
      color: var(--success);
    }

/* Minimal modal styling */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;               /* Hidden by default; show via JS when needed */
  align-items: center;
  justify-content: center;
  background: transparent;     /* No tinted overlay */
  backdrop-filter: none;       /* No blur */
  z-index: 10002;
}

.modal-content {
  position: absolute;
  /* Offsets the modal from the left so it's centered relative to main content on desktop */
  top: 50%;
  left: 50%; /* Default center */
  transform: translate(-50%, -50%);

  background: #fff;            /* Plain white background */
  border: 1px solid #ddd;      /* Subtle border */
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Light shadow */
  color: #333;                 /* Dark text for contrast on white */
  padding: 2rem;
  width: 90%;
  max-width: 600px;            /* Restrict width on large screens */
  max-height: 80vh;            /* Scrollable if content is tall */
  overflow-y: auto;
  animation: fadeInScale 0.3s ease-out forwards;
}

/* Desktop modal positioning with sidebar */
@media (min-width: 993px) {
    .modal-content {
        left: calc(50% + 100px); /* Offset by half sidebar width */
    }
}


/* Example fade-in scale keyframes (optional if you still want an animation) */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Make sure all text inside the modal is sufficiently dark */
.modal-content,
.modal-content p,
.modal-content li,
.modal-content .instructions-content,
.modal-content span,
.modal-content label {
  color: var(--ink-light, #3d3d3d);
}

.modal-content h2,
.modal-content h3 {
  color: var(--ink, #1a1a1a);
}

    /* Styles for the close button */
    .close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.close-btn:hover {
  background-color: #f1f5f9;
}

.close-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px #e2e8f0;
}

    .modal-content h2 {
      padding-bottom: 3rem;
      position: relative;
      margin-top: 0;
      font-family: 'Inter', sans-serif;
    }

    .dropdowns {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin: 20px 0;
    }

   /* Dropdown styling: white background, black text */
.dropdowns select,
.dropdowns button {
  background: #fff;
  color: var(--ink-light, #3d3d3d);
  border: 1px solid var(--rule, #d4d0c8);
  border-radius: 4px;
  padding: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Keep or tweak focus/hover styles as desired */
.dropdowns select:focus,
.dropdowns button:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 5px rgba(96,165,250,0.5);
}
.dropdowns button:hover {
  background-color: #f1f5f9;
}

    .instructions-content {
      white-space: pre-wrap;
      font-family: monospace;
      font-size: 0.95rem;
      line-height: 1.5;
      /* color: #e0e0e0; */ /* Overridden above */
      margin-top: 20px;
    }

    /* Reset and override terms modal styles */
#termsModal {
  display: flex !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(26, 26, 26, 0.6) !important;
  z-index: 11000 !important;
  backdrop-filter: blur(4px) !important;
}

#termsModal .modal-content {
  position: static !important; /* Changed to static to avoid any positioning */
  transform: none !important; /* Remove any transform */
  top: auto !important; /* Reset any top value */
  left: auto !important; /* Reset any left value */
  margin: 0 auto !important; /* Center horizontally */
  background: #fff !important;
  border: 1px solid var(--rule, #d4d0c8) !important;
  border-radius: var(--ed-radius-lg, 8px) !important;
  padding: 20px !important;
  width: 90% !important;
  max-width: 600px !important;
  max-height: 80vh !important;
  overflow-y: auto !important;
  color: var(--ink-light, #3d3d3d) !important;
}

    .terms-scroll {
      max-height: 300px;
      overflow-y: auto;
      margin: 20px 0;
      padding: 10px;
      border: 1px solid #ddd;
    }
    .accept-btn {
      padding: 10px 20px;
      background: #4CAF50;
      color: white;
      border: none;
      border-radius: 4px;
      cursor: pointer;
    }

    /* Login & Register Modals (hidden by default) */
    #loginModal, #registerModal {
      display: none;
    }

    .modal-form {
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }
    .modal-form label {
      font-weight: 600;
      margin-bottom: 0.25rem;
    }
    .modal-form input[type="email"],
    .modal-form input[type="password"] {
      padding: 0.5rem;
      border: 1px solid var(--neutral-200);
      border-radius: 4px;
    }
    .modal-form button {
      padding: 0.75rem 1rem;
      border: none;
      border-radius: 4px;
      background: var(--primary-dark);
      color: #fff;
      cursor: pointer;
      font-weight: 600;
      transition: background 0.2s;
    }
    .modal-form button:hover {
      background: var(--primary);
    }
    .close-modal {
      background: var(--error);
      color: #fff;
      margin-left: 0.5rem;
      cursor: pointer;
    }

    /* Login notification bar */
.login-notification {
  background-color: #f8d7da;
  color: #721c24;
  padding: 10px 15px;
  margin: -2rem -2rem 2rem -2rem;
  border-radius: 8px 8px 0 0;
  text-align: center;
  font-weight: 500;
  border-bottom: 1px solid #f5c6cb;
}

/* Registration prompt styling */
.register-prompt {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--neutral-200);
  text-align: center;
}

.register-link {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

.register-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Login Required Modal Styles */
.login-required-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.login-required-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.login-required-content {
  position: relative;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
  max-width: 420px;
  width: 100%;
  padding: 2rem;
  animation: loginModalFadeIn 0.3s ease-out forwards;
  border: 1px solid rgba(169, 214, 229, 0.3);
}

@keyframes loginModalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.login-required-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-required-close:hover {
  background: rgba(248, 250, 252, 0.8);
  color: #334155;
}

.login-required-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-required-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0A4D8F 0%, #073763 100%);
  color: white;
  margin-bottom: 1rem;
}

.login-required-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 0.5rem 0;
}

.login-required-message {
  color: #6b7280;
  font-size: 1rem;
  margin: 0;
  line-height: 1.5;
}

.login-required-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.login-required-btn-primary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(90deg, #0A4D8F, #073763);
  color: white;
  border: none;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s ease;
  transform-origin: center;
}

.login-required-btn-primary:hover {
  background: linear-gradient(90deg, #073763, #0A4D8F);
  transform: scale(1.02) translateY(-1px);
  box-shadow: 0 8px 16px rgba(10, 77, 143, 0.3), 0 4px 8px rgba(0, 0, 0, 0.15);
}

.login-required-btn-secondary {
  flex: 1;
  background: #f8fafc;
  color: #0A4D8F;
  border: 1px solid #A9D6E5;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.login-required-btn-secondary:hover {
  background: #D6EAF8;
  border-color: #0A4D8F;
  transform: scale(1.02) translateY(-1px);
  box-shadow: 0 4px 8px rgba(10, 77, 143, 0.15);
}

.login-required-footer {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.login-required-footer p {
  color: #6b7280;
  font-size: 0.875rem;
  margin: 0;
}

.login-required-register-link {
  color: #0A4D8F;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.login-required-register-link:hover {
  color: #073763;
  text-decoration: underline;
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
  .login-required-content {
    margin: 1rem;
    padding: 1.5rem;
  }
  
  .login-required-actions {
    flex-direction: column;
  }
  
  .login-required-title {
    font-size: 1.25rem;
  }
}

    /* --- Sidebar --- */
    .sidebar {
      width: 200px; /* Default desktop width */
      background-color: #f8f9fa;
      padding: 20px;
      border-right: 1px solid #dee2e6;
      /* margin-top: 70px; Removed, now position fixed/controlled by JS */
      flex-shrink: 0; /* Prevent sidebar from shrinking */
      box-sizing: border-box; /* Include padding in width */
      transition: width 0.3s ease-in-out; /* Smooth transition for desktop */
    }
    .logo-section {
      padding-bottom: 20px;
      margin-bottom: 20px;
      border-bottom: 1px solid #dee2e6;
    }
    .logo-title {
      font-size: 1.25rem;
      font-weight: 600;
      color: #333;
      margin: 0;
    }
    .nav-list {
      list-style: none;
      padding: 0;
      margin: 0;
    }
    .nav-item {
      margin-bottom: 8px;
    }
    .nav-link {
      display: block;
      padding: 8px 12px;
      color: #495057;
      text-decoration: none;
      border-radius: 4px;
      transition: all 0.2s ease;
    }
    .nav-link:hover {
      background-color: #e9ecef;
      color: #228be6;
    }

    /* Sidebar Support Link */
      .support-link {
        background: var(--riq-primary, #5b6eae);
        color: white;
        padding: 0.5rem 1rem;
        border-radius: var(--ed-radius, 4px);
        margin-top: 1rem;
        text-align: center;
        font-weight: 500;
        transition: all 0.2s ease;
        display: block;
    }
    .support-link:hover {
        background: var(--riq-deep, #3d4d7a);
        color: white;
    }
    /* Ensure spacing for last item */
    .nav-list .nav-item:last-of-type { margin-top: 1rem; }

    /* --- Main Content --- */
    .main-content {
      flex: 1;
      padding: 2rem;
      background: linear-gradient(135deg, #fefefe 0%, #f8fafc 100%);
      /* margin-top: 70px; Removed, handled by body padding */
      margin-left: 0; /* Default desktop margin */
      border-radius: 1rem 1rem 0 0;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
      position: relative;
      box-sizing: border-box;
      min-width: 0; /* Prevents flex item from overflowing */
    }
    .tool-container {
      max-width: 1200px;
      margin: 0 auto;
      position: relative;
    }
    .container {
      max-width: 1200px;
      margin: 2rem auto;
      padding: 2rem;
    }

    .header {
      display: flex;
      flex-direction: column;
      align-items: center;
      text-align: center;
      margin-bottom: 1.5rem;
      padding: 1rem;
    }

    .header p {
      color: var(--neutral-700);
      font-size: 1.25rem;
      opacity: 0.9;
    }
    .header-image {
      margin-bottom: 1rem;
      max-width: 400px;
      width: 80%; /* Make responsive */
    }

    .tier-display {
      margin: 1rem auto;
      /* Tier badge specific styles follow */
    }

    .header-content {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;  /* Adds consistent spacing between elements */
    }

    .header-title {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
      font-size: 2.25rem;
      font-weight: 200;
      color: #003399;
      margin: 0;
      padding: 0;
      text-align: center;
      text-transform: none;
      letter-spacing: 0.025em;
    }

    .header-description {
      font-size: 1.1rem;
      color: #475569;
      margin: 0;
      line-height: 1.5;
    }

    .header-guarantee {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
      border: 1px solid #10b981;
      border-radius: 2rem;
      padding: 0.6rem 1.25rem;
      margin-top: 0.5rem;
      font-size: 0.95rem;
      font-weight: 600;
      color: #065f46;
      box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
    }

    .header-guarantee i {
      color: #10b981;
    }

    .guide-button {
      background-color: var(--neutral-100);
      color: var(--primary-dark);
      border: 2px solid var(--primary);
      padding: 0.75rem 1.5rem;
      border-radius: 0.75rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      margin-top: 0.5rem;
    }
    .guide-button:hover {
      background-color: var(--primary);
      color: white;
      transform: translateY(-2px);
    }
    .guide-section {
      background: var(--neutral-50);
      border-radius: 1rem;
      padding: 2rem;
      margin: 2rem 0;
      border: 2px solid var(--neutral-200);
    }
    .guide-section code {
      display: block;
      background: white;
      padding: 1rem;
      border-radius: 0.5rem;
      margin: 1rem 0;
      font-family: 'Fira Code', monospace;
      border: 1px solid var(--neutral-200);
      white-space: pre-wrap; /* Allow wrapping */
      word-break: break-word; /* Break long words */
    }

    .input-section {
      display: grid; /* Use grid */
      gap: 2rem;
      background: linear-gradient(135deg, #f8fafc 0%, #ffffff 50%, #f1f5f9 100%);
      padding: 2.5rem;
      border-radius: 1.25rem;
      border: 1px solid rgba(148, 163, 184, 0.2);
      box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.05),
        0 10px 25px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
      backdrop-filter: blur(10px);
      transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .input-section:hover {
      transform: translateY(-2px);
      box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.07),
        0 20px 40px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    }

    /* --- View History Tab Styling --- */
.input-section {
    position: relative; /* Needed for absolute positioning of the view history tab */
}

.view-history-tab {
    display: inline-flex;
    align-items: center;
    position: absolute;
    top: -1px; /* To sit on top of the border of input-section */
    left: 2rem;  /* Adjust as needed, same as input-section's padding-left */
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #475569;
    padding: 0.75rem 1.5rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-bottom: none; /* To make it look like it's part of the top edge */
    border-radius: 0.75rem 0.75rem 0 0; /* Rounded top corners */
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5; /* To ensure it's above the main content of input-section */
    text-decoration: none; /* Remove underline from <a> tag */
    box-shadow: 
      0 -2px 4px rgba(0, 0, 0, 0.05),
      inset 0 1px 0 rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
}

.view-history-tab:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1d4ed8;
    transform: translateY(-3px); /* Slight lift on hover */
    box-shadow: 
      0 -4px 8px rgba(59, 130, 246, 0.15),
      0 -2px 4px rgba(0, 0, 0, 0.05),
      inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.view-history-tab:active {
    transform: translateY(-1px);
    background-color: var(--neutral-300, #d1d5db); /* Fallback for neutral-300 */
}

.view-history-tab i { /* Lucide icon styling within the tab */
    margin-right: 0.4em;
    width: 1.1em; /* Adjust icon size if needed */
    height: 1.1em;
    vertical-align: -0.15em;
}

/* Adjustments for smaller screens if necessary */
@media (max-width: 640px) {
    .view-history-tab {
        left: 1rem; /* Adjust for smaller padding of input-section */
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
}

/* =====================================================================
   MODE SWITCHING CONTROL - Clean Segmented Control Design
   ===================================================================== */

.mode-selector {
    display: flex;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px solid #e2e8f0;
    border-radius: 1rem;
    padding: 0.375rem;
    margin: 1.5rem 0;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.06),
        0 4px 12px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.mode-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.25rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-weight: 500;
    font-size: 0.9rem;
    background: transparent;
    color: #64748b;
    user-select: none;
    overflow: hidden;
}

.mode-option:hover:not(.active) {
    color: #334155;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.6) 0%, rgba(248, 250, 252, 0.4) 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mode-option:active:not(.active) {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.3);
}

.mode-option.active {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    color: #1e293b;
    font-weight: 600;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.12),
        0 2px 4px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transform: translateY(-2px) scale(1.02);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.mode-indicator {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    margin-right: 0.5rem;
    background: #d1d5db;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Bank Mode Indicator (Blue when active) */
#bankModeOption.active .mode-indicator {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.2),
        0 0 8px rgba(59, 130, 246, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
    animation: pulse-indicator-blue 2s ease-in-out infinite;
}

/* Invoice Mode Indicator (Green when active) */
#invoiceModeOption.active .mode-indicator {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 
        0 0 0 3px rgba(16, 185, 129, 0.2),
        0 0 8px rgba(16, 185, 129, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
    animation: pulse-indicator-green 2s ease-in-out infinite;
}

@keyframes pulse-indicator-blue {
    0%, 100% {
        box-shadow: 
            0 0 0 3px rgba(59, 130, 246, 0.2),
            0 0 8px rgba(59, 130, 246, 0.4),
            inset 0 1px 2px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 
            0 0 0 4px rgba(59, 130, 246, 0.3),
            0 0 12px rgba(59, 130, 246, 0.6),
            inset 0 1px 2px rgba(255, 255, 255, 0.4);
    }
}

@keyframes pulse-indicator-green {
    0%, 100% {
        box-shadow: 
            0 0 0 3px rgba(16, 185, 129, 0.2),
            0 0 8px rgba(16, 185, 129, 0.4),
            inset 0 1px 2px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 
            0 0 0 4px rgba(16, 185, 129, 0.3),
            0 0 12px rgba(16, 185, 129, 0.6),
            inset 0 1px 2px rgba(255, 255, 255, 0.4);
    }
}

/* =====================================================================
   EXPLANATION BANNER STYLING
   ===================================================================== */

.explanation-banner {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #0ea5e9;
    border-radius: 1rem;
    padding: 1.5rem;
    margin: 1rem 0 1.5rem 0;
    position: relative;
    box-shadow: 
        0 4px 12px rgba(14, 165, 233, 0.1),
        0 2px 4px rgba(14, 165, 233, 0.05);
    backdrop-filter: blur(10px);
    animation: slideInBanner 0.4s ease-out;
}

.banner-icon {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.banner-content {
    margin-left: 3rem;
    margin-right: 2.5rem;
}

.banner-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #0c4a6e;
}

.banner-content p {
    margin: 0.5rem 0;
    font-size: 0.875rem;
    color: #164e63;
    line-height: 1.5;
}

.criteria-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin: 0.75rem 0;
}

.criteria-item {
    font-size: 0.8rem;
    color: #155e75;
    background: rgba(255, 255, 255, 0.6);
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    border-left: 3px solid #0ea5e9;
    font-weight: 500;
}

.banner-note {
    font-size: 0.8rem;
    color: var(--ink-muted, #6b6b6b);
    font-style: italic;
    margin-top: 0.75rem;
}

.banner-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e0f2fe;
    border-radius: 0.375rem;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.banner-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #fecaca;
    color: #dc2626;
    transform: scale(1.1);
}

@keyframes slideInBanner {
    0% {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        max-height: 300px;
    }
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .mode-selector {
        margin: 1rem 0;
    }
    
    .mode-option {
        padding: 0.625rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .mode-label {
        display: none; /* Hide labels on very small screens, show only indicators */
    }
    
    .mode-indicator {
        margin-right: 0;
        width: 0.75rem;
        height: 0.75rem;
    }
    
    .explanation-banner {
        padding: 1rem;
        margin: 0.75rem 0 1rem 0;
    }
    
    .banner-content {
        margin-left: 2.5rem;
        margin-right: 2rem;
    }
    
    .criteria-list {
        gap: 0.25rem;
    }
    
    .criteria-item {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Invoice Results Styling */
.invoice-results {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--neutral-200);
}

.invoice-results h3 {
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.invoice-results h4 {
    color: var(--primary);
    margin: 2rem 0 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.invoice-results .summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.invoice-results .summary p {
    background: var(--primary-light);
    padding: 1rem;
    border-radius: 8px;
    margin: 0;
    text-align: center;
    font-weight: 500;
}

.matched-pairs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.match-pair {
    background: var(--neutral-50);
    border: 1px solid var(--neutral-200);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.9rem;
}

.match-pair div {
    margin-bottom: 0.5rem;
}

.match-pair div:last-child {
    margin-bottom: 0;
    color: var(--success);
    font-weight: 600;
}


    .file-upload-section {
      /* Removed width/max-width - let grid handle it */
      /* width: 90%; */
      /* max-width: 800px; */
      /* margin: 2rem auto; Removed */
      padding: 2rem;
      background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
      border-radius: 1rem;
      border: 1px solid rgba(226, 232, 240, 0.8);
      box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.02),
        0 8px 16px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      position: relative;
      overflow: hidden;
    }
    
    .file-upload-section::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 1px;
      background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.3), transparent);
    }
    
    .file-upload-section:hover {
      transform: translateY(-1px);
      box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.04),
        0 12px 24px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
      border-color: rgba(59, 130, 246, 0.2);
    }

    .file-input-container {
      margin-bottom: 2rem;
      position: relative;
    }

    .file-label {
      display: flex;
      align-items: center;
      padding: 1.25rem;
      background: linear-gradient(135deg, #f8fafc 0%, #ffffff 50%, #f1f5f9 100%);
      border: 2px dashed rgba(148, 163, 184, 0.4);
      border-radius: 0.75rem;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      position: relative;
      overflow: hidden;
      box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    }
    

    .file-label:hover {
      border-color: rgba(59, 130, 246, 0.6);
      transform: translateY(-1px);
      box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.05),
        0 10px 20px rgba(59, 130, 246, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }

    /* Drag and drop highlight */
    .file-label.drag-over {
      border-color: var(--primary);
      background-color: #eef2ff;
      transform: scale(1.02);
      box-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
    }


    .file-icon {
      margin-right: 1rem;
      width: 1.5rem;
      height: 1.5rem;
      color: #64748b;
      flex-shrink: 0; /* Prevent icon shrinking */
    }
     /* Ensure Lucide icons are sized */
    .file-icon i {
        width: 1.5rem;
        height: 1.5rem;
    }


    .file-text {
      flex: 1;
      font-size: 0.95rem;
      color: #475569;
      min-width: 0; /* Allow text to shrink */
      overflow: hidden; /* Hide overflow */
      text-overflow: ellipsis; /* Add ellipsis */
      white-space: nowrap; /* Prevent wrapping */
    }

    .file-button {
      padding: 0.75rem 1.5rem;
      background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
      color: white;
      border-radius: 0.5rem;
      font-size: 0.875rem;
      font-weight: 600;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      margin-left: 1rem;
      box-shadow: 
        0 2px 4px rgba(59, 130, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
      border: 1px solid rgba(37, 99, 235, 0.3);
      position: relative;
      z-index: 2;
    }

    .file-label:hover .file-button {
      background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
      transform: translateY(-1px);
      box-shadow: 
        0 4px 8px rgba(59, 130, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    
    .file-button:active {
      transform: translateY(0);
      box-shadow: 
        0 1px 2px rgba(59, 130, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }

    .file-input-hidden {
      display: none;
    }

    .file-name {
      display: block;
      margin-top: 0.75rem;
      font-size: 0.875rem;
      color: #64748b;
      padding-left: calc(1.5rem + 1rem); /* Align with file text (icon width + margin) */
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-weight: 500;
      transition: color 0.2s ease;
    }
    
    .file-label:hover + .file-name {
      color: #475569;
    }

    .reconcile-button {
      width: 100%;
      padding: 1.25rem;
      background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
      color: white;
      border: none;
      border-radius: 0.75rem;
      font-size: 1rem;
      font-weight: 600;
      box-shadow: 
        0 4px 6px rgba(59, 130, 246, 0.2),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      position: relative;
      overflow: hidden;
      cursor: pointer;
    }
    
    
    .reconcile-button:hover {
      background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #1e40af 100%);
      transform: translateY(-2px);
      box-shadow: 
        0 8px 16px rgba(59, 130, 246, 0.3),
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    
    .reconcile-button:active {
      transform: translateY(-1px);
      box-shadow: 
        0 4px 8px rgba(59, 130, 246, 0.2),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
      display: inline-flex; /* Align icon */
      align-items: center;
      justify-content: center;
      gap: 0.5em;
    }

    .reconcile-button:hover {
  background: #2563eb;
}

/* PDF Converter Styles */
.pdf-converter-section {
  margin-bottom: 1rem;
  padding: 1rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  display: none;
}

.pdf-converter-section.active {
  display: block;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    padding: 0 1rem;
  }
  to {
    opacity: 1;
    max-height: 500px;
    padding: 1rem;
  }
}

.pdf-upload-area {
  border: 2px dashed #94a3b8;
  border-radius: 6px;
  padding: 1.5rem;
  text-align: center;
  background: #fafafa;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
}

.pdf-upload-area:hover {
  border-color: #3b82f6;
  background: #f0f9ff;
}

.pdf-upload-area.dragover {
  border-color: var(--riq-primary, #5b6eae);
  background: var(--riq-light, #e8ebf4);
  transform: scale(1.02);
}

.pdf-success-compartments {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 120px;
}

.pdf-compartment {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 8px; /* Updated border-radius */
  position: relative;
  overflow: hidden; /* Added overflow hidden */
}

/* New styles for PDF success compartments */
.pdf-download-compartment {
  background: #f8fafc; /* Light gray background */
  border: 2px solid #10b981; /* Emerald border */
  transition: all 0.2s ease;
  /* Ensure other necessary styles from .pdf-compartment are inherited or explicitly set if overridden */
}

.pdf-download-compartment:hover {
  background: #f0fdf4; /* Lighter emerald on hover */
  border-color: #059669; /* Darker emerald border on hover */
  transform: translateY(-2px);
  box-shadow: 0 8px 12px rgba(16, 185, 129, 0.15); /* Softer, more modern shadow */
}

.pdf-use-compartment {
  background: #f8fafc; /* Light gray background */
  border: 2px solid #3b82f6; /* Blue border */
  transition: all 0.2s ease;
  /* Ensure other necessary styles from .pdf-compartment are inherited or explicitly set if overridden */
}

.pdf-use-compartment:hover {
  background: #eff6ff; /* Lighter blue on hover */
  border-color: #2563eb; /* Darker blue border on hover */
  transform: translateY(-2px);
  box-shadow: 0 8px 12px rgba(59, 130, 246, 0.15); /* Softer, more modern shadow */
}

.pdf-compartment-divider {
  width: 1px;
  background: linear-gradient(to bottom, transparent, #d1d5db, transparent);
  margin: 0.5rem 0;
  flex-shrink: 0;
}

.pdf-upload-initial {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

@media (max-width: 640px) {
  .pdf-success-compartments {
    flex-direction: column;
    min-height: 140px;
  }
  
  .pdf-compartment-divider {
    width: 100%;
    height: 1px;
    margin: 0;
  }
  
  .pdf-compartment {
    padding: 0.75rem;
  }
}

.pdf-progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin: 1rem 0;
}

.pdf-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.pdf-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.pdf-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.pdf-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pdf-btn-primary {
  background: #3b82f6;
  color: white;
}

.pdf-btn-primary:hover:not(:disabled) {
  background: #2563eb;
}

.pdf-btn-success {
  background: #10b981;
  color: white;
}

.pdf-btn-success:hover:not(:disabled) {
  background: #059669;
}

.pdf-btn-secondary {
  background: #6b7280;
  color: white;
}

.pdf-btn-secondary:hover:not(:disabled) {
  background: #4b5563;
}

.pdf-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 1rem;
  background: white;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.pdf-stat {
  text-align: center;
}

.pdf-stat-number {
  font-size: 1.25rem;
  font-weight: bold;
  color: #1f2937;
}

.pdf-stat-label {
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pdf-toggle-link {
  color: #3b82f6;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-radius: 0.5rem;
  border: 1px solid rgba(59, 130, 246, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.pdf-toggle-link:hover {
  color: #1d4ed8;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.15);
  text-decoration: none;
}

.pdf-file-info {
  margin: 1rem 0;
  padding: 1rem;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border-radius: 0.75rem;
  font-size: 0.875rem;
  color: #374151;
  border: 1px solid rgba(156, 163, 175, 0.2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  font-weight: 500;
}

.pdf-error {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #dc2626;
  padding: 1rem;
  border-radius: 0.75rem;
  margin: 1rem 0;
  border: 1px solid rgba(239, 68, 68, 0.2);
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.1);
  font-weight: 500;
}

.pdf-success {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  color: #166534;
  padding: 1rem;
  border-radius: 0.75rem;
  margin: 1rem 0;
  border: 1px solid rgba(34, 197, 94, 0.2);
  box-shadow: 0 1px 3px rgba(22, 101, 52, 0.1);
  font-weight: 500;
}

@media (max-width: 640px) {
  .pdf-actions {
    flex-direction: column;
  }
  
  .pdf-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

    .error { /* This is the #error div style */
      display: none; /* Add display none initially */
      margin-top: 1rem;
      padding: 1rem;
      background: #fee2e2;
      color: #dc2626;
      border-radius: 6px;
      font-size: 0.875rem;
      align-items: center; /* If using flex */
      gap: 0.5rem; /* If using flex */
      animation: shake 0.5s ease-in-out;
    }

      color: var(--primary-dark);
    }

    /* Removed duplicate #error style */

    .result-section {
      background: white;
      border-radius: 1rem;
      padding: 2rem;
      margin: 2rem 0;
      box-shadow: var(--shadow);
      animation: slideIn 0.5s ease-out;
    }
    .result-section h2 {
      color: var(--primary-dark);
      margin: 0 0 1.5rem;
      padding-bottom: 1rem;
      border-bottom: 2px solid var(--neutral-200);
    }

    /* --- Results Table Styling --- */
    .results-table-wrapper { /* Add wrapper for horizontal scroll */
        overflow-x: auto;
        width: 100%;
    }
    table {
      width: 100%;
      border-collapse: collapse;
      margin: 1.5rem 0;
      min-width: 600px; /* Ensure table has a minimum width */
    }
    th {
      background: var(--primary);
      color: white;
      padding: 1rem;
      text-align: left;
      font-weight: 600;
      position: sticky;
      top: 70px; /* Height of fixed top bar */
      z-index: 10; /* Ensure header is above table content */
      border-bottom: 2px solid var(--primary-dark);
      white-space: nowrap; /* Prevent header wrapping */
    }
    td {
      padding: 1rem;
      border-bottom: 1px solid var(--neutral-200);
      white-space: nowrap; /* Prevent cell wrapping initially */
    }
     /* Allow description column to wrap */
    td.description-cell {
        white-space: normal;
        min-width: 200px; /* Give description more space */
        max-width: 400px; /* Limit max width */
        word-break: break-word;
    }
    tr:last-child td {
      border-bottom: none;
    }
    tr:hover td {
      background: var(--neutral-50);
    }
    .amount {
      font-family: 'Fira Code', monospace;
      font-weight: 500;
      text-align: right; /* Align amounts right */
    }
    .positive { color: var(--success); }
    .negative { color: var(--error); }

    .download-button {
      background: var(--neutral-100);
      color: var(--primary-dark);
      border: 2px solid var(--primary);
      padding: 0.75rem 1.5rem;
      border-radius: 0.75rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
    }
    .download-button:hover {
      background: var(--primary);
      color: white;
      transform: translateY(-2px);
    }

    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(10px); }
      to { opacity: 1; transform: translateY(0); }
    }
    @keyframes slideIn {
      from { opacity: 0; transform: translateX(-10px); }
      to { opacity: 1; transform: translateX(0); }
    }
    @keyframes shake {
      0%, 100% { transform: translateX(0); }
      25% { transform: translateX(-5px); }
      75% { transform: translateX(5px); }
    }

    @media (max-width: 640px) { /* Smaller mobile adjustments */
      .container {
        padding: 1rem;
        margin: 1rem auto; /* Center container */
      }
      .header h1, .header-title { /* Target both */
        font-size: 1.8rem; /* Adjust size */
      }
      .header-guarantee {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
        text-align: center;
      }
      .input-section, .guide-section, .result-section {
          padding: 1rem; /* Reduce padding on sections */
      }
      .file-label { padding: 0.8rem; }
      .file-text { font-size: 0.9rem; }
      .file-button { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
      .file-name { padding-left: calc(1.5rem + 0.8rem); /* Adjust padding */ }
       th, td { padding: 0.8rem; } /* Reduce table padding */
       td.description-cell { min-width: 150px; }
       .reconcile-button { font-size: 0.9rem; padding: 0.8rem; }
       .guide-button, .download-button { font-size: 0.9rem; padding: 0.6rem 1.2rem; }
       .header-description { font-size: 1rem; }
    }


    /* Right-hand nav pinned on top, hidden by default */
    #resultsNavigation {
      position: fixed;
      top: 120px; /* Adjust if needed based on top bar */
      right: 20px;
      width: 200px;
      padding: 1rem;
      background: var(--neutral-50);
      border-radius: 1rem;
      border: 1px solid var(--neutral-200);
      box-shadow: var(--shadow);
      text-align: center;
      z-index: 3000;
      display: none; /* Hidden initially, shown by JS on desktop results */
    }
    #resultsNavigation h4 {
      margin-top: 0;
      color: var(--primary-dark);
    }
    #resultsNavigation button {
      background: linear-gradient(135deg, var(--primary), var(--primary-dark));
      color: #fff;
      border: none;
      padding: 0.5rem 1rem;
      border-radius: 0.5rem;
      font-weight: 600;
      cursor: pointer;
      margin: 0.5rem 0;
      width: 100%; /* Make buttons full width */
      transition: all 0.2s;
    }
    #resultsNavigation button:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-lg);
    }
     /* Show results nav only on larger screens */
     @media (min-width: 1200px) {
        #resultsNavigation.visible { /* Add .visible class via JS */
             display: block;
         }
     }

  /* Credit Display Styles */
  .credit-status {
      background: var(--neutral-50);
      border: 2px solid var(--neutral-200);
      border-radius: 0.75rem;
      padding: 1.5rem;
      margin-bottom: 1.5rem;
      transition: all 0.2s ease;
      position: relative;
      overflow: visible;
  }

  .credit-counts {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 1rem;
  }

  .credit-item {
      flex: 1;
      min-width: 200px;
      background: white;
      padding: 1rem;
      border: 1px solid var(--neutral-200);
      border-radius: 0.5rem;
      box-shadow: var(--shadow-sm);
  }

  .credit-label {
      display: block;
      color: var(--neutral-700);
      font-weight: 600;
      font-size: 0.9rem;
      margin-bottom: 0.25rem;
  }

  .credit-value {
      display: block;
      color: var(--primary-dark);
      font-size: 1.1rem;
      font-weight: 500;
  }

  /* Styles for highlighting low credits */
  .credit-value.low-credits {
      color: var(--error);
      animation: pulse 2s infinite;
  }

  @keyframes pulse {
      0% { opacity: 1; }
      50% { opacity: 0.7; }
      100% { opacity: 1; }
  }

  /* Credit Animation Styles */
  .credit-deduction {
      position: absolute;
      font-size: 1.5rem;
      font-weight: bold;
      color: #dc2626;
      pointer-events: none;
      z-index: 1000;
      animation: floatUp 2s ease-out forwards;
  }

  @keyframes floatUp {
      0% {
          opacity: 1;
          transform: translateY(0) scale(1);
      }
      50% {
          opacity: 1;
          transform: translateY(-30px) scale(1.2);
      }
      100% {
          opacity: 0;
          transform: translateY(-60px) scale(0.8);
      }
  }

  .credit-value.animating {
      animation: creditChange 0.6s ease-in-out;
  }

  @keyframes creditChange {
      0% {
          transform: scale(1);
          color: var(--primary-dark);
      }
      25% {
          transform: scale(1.2);
          color: #dc2626;
      }
      50% {
          transform: scale(1.1);
      }
      100% {
          transform: scale(1);
          color: var(--primary-dark);
      }
  }

  .credit-item.credit-flash {
      animation: flashBorder 0.6s ease-in-out;
  }

  @keyframes flashBorder {
      0% {
          border-color: var(--neutral-200);
          box-shadow: var(--shadow-sm);
      }
      50% {
          border-color: #dc2626;
          box-shadow: 0 0 10px rgba(220, 38, 38, 0.3);
      }
      100% {
          border-color: var(--neutral-200);
          box-shadow: var(--shadow-sm);
      }
  }

  /* Responsive adjustments for credits */
  @media (max-width: 640px) {
      .credit-counts {
          flex-direction: column;
      }
      .credit-item {
          min-width: auto; /* Allow shrinking */
          width: 100%; /* Take full width */
      }
  }

  /* Credit Upsell Link */
  .credit-upsell {
      margin-top: 0.75rem;
      text-align: center;
  }

  .credit-upsell-link {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.5rem 1rem;
      font-size: 0.85rem;
      font-weight: 600;
      color: #7c3aed;
      background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1));
      border: 1px solid rgba(139, 92, 246, 0.3);
      border-radius: 2rem;
      text-decoration: none;
      transition: all 0.2s ease;
  }

  .credit-upsell-link:hover {
      background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
      border-color: rgba(139, 92, 246, 0.5);
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
  }

  .credit-upsell-link .upsell-text {
      background: linear-gradient(135deg, #7c3aed, #db2777);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
  }

  .credit-upsell-link i {
      color: #7c3aed;
  }

/* Tier badges: inherited from iq-suite-editorial.css */


/* --- START: Improved Animation CSS --- */

/* --- Base Styles for Visualization --- */
.reconciliation-viz {
    display: flex;
    justify-content: space-around; /* Use space-around */
    align-items: center; /* Vertically center items */
    margin: 2rem 0;
    padding: 1rem;
    background: var(--neutral-100); /* Slightly darker bg */
    border-radius: 0.75rem; /* Larger radius */
    min-height: 350px; /* Increased height */
    gap: 1.5rem; /* Increased gap */
    position: relative; /* Needed for absolute positioning of counter */
    flex-direction: column; /* Stack on mobile */
}
@media (min-width: 768px) { /* Apply side-by-side layout only on larger screens */
    .reconciliation-viz {
        flex-direction: row;
    }
}

.bank-side, .book-side {
    flex: 1;
    width: 100%; /* Full width on mobile */
    max-width: 100%; /* Override max-width on mobile */
    background: white;
    border-radius: 0.75rem; /* Match parent */
    box-shadow: var(--shadow); /* Slightly stronger shadow */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 320px; /* Fixed height for streams */
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}
@media (min-width: 768px) {
    .bank-side, .book-side {
        max-width: 45%; /* Restore max-width on desktop */
    }
}

.side-label {
    background: var(--primary-dark);
    color: white;
    padding: 0.75rem 1rem; /* Increased padding */
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Subtle separator */
}

.transaction-stream {
    flex-grow: 1; /* Allow stream to fill available space */
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem; /* Increased padding */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: var(--primary-light) var(--neutral-100); /* Firefox */
}
/* Webkit scrollbar styles */
.transaction-stream::-webkit-scrollbar { width: 6px; }
.transaction-stream::-webkit-scrollbar-track { background: var(--neutral-100); border-radius: 3px; }
.transaction-stream::-webkit-scrollbar-thumb { background-color: var(--primary-light); border-radius: 3px; border: 1px solid var(--neutral-100); }


/* --- Transaction Styling & Matching Animation --- */
.transaction {
    background: var(--neutral-50);
    border-radius: 0.375rem; /* Slightly rounder */
    padding: 0.6rem 0.8rem; /* Adjust padding */
    opacity: 1;
    border-left: 4px solid transparent; /* Wider indicator */
    transition:
        background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s ease-out,
        transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), /* Bounce effect */
        border-left-color 0.4s ease;
    transform-origin: center left;
    cursor: default; /* Indicate non-interactive */
}
/* Add hover effect for non-matched */
.transaction:not(.matched):hover {
    background-color: var(--neutral-100);
    border-left-color: var(--neutral-200);
}


.transaction.matched {
    background: #e6fffa;
    color: #2d3748; /* Slightly darker text */
    border-left-color: var(--success);
    transform: scale(1.02); /* Pop effect */
    animation: fillMatchedBg 0.5s ease-out forwards;
    cursor: pointer; /* Indicate potential interaction (if needed) */
}

/* Text color transitions - applied via JS adding .animation-complete */
.transaction.matched .transaction-amount,
.transaction.matched .transaction-date,
.transaction.matched .transaction-desc {
    color: inherit !important; /* Start with inherited color */
    transition: color 0.3s ease-out 0.3s; /* Delay color change */
}

.transaction.matched.animation-complete {
    background-color: var(--success); /* Final solid background */
    color: white;
}

.transaction.matched.animation-complete .transaction-amount,
.transaction.matched.animation-complete .transaction-date,
.transaction.matched.animation-complete .transaction-desc {
     color: white !important; /* Final white text */
}

@keyframes fillMatchedBg {
    from { background-color: #e6fffa; }
    to { background-color: var(--success); }
}

/* --- Match Counter Animation --- */
.match-counter {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary);
    background: white;
    border-radius: 50%;
    width: 4rem; /* Larger counter */
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg); /* Stronger shadow */
    position: absolute; /* Position in the middle */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%); /* Center perfectly */
    z-index: 20; /* Above streams */
    transition:
        transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        color 0.3s ease-out,
        background-color 0.3s ease-out,
        box-shadow 0.3s ease-out;
    order: 1; /* Ensure it's between bank/book on mobile */
    margin: 1rem 0; /* Add margin for mobile layout */
}
@media (min-width: 768px) {
    .match-counter {
        order: 0; /* Reset order for desktop */
        margin: 0; /* Remove margin */
        position: absolute; /* Keep absolute for desktop */
    }
}


.match-counter.pulse {
    transform: translate(-50%, -50%) scale(1.2); /* Adjust transform */
    color: var(--success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6); /* Enhanced glow */
}

.match-counter.complete {
    background-color: var(--success);
    color: white;
    animation: celebration 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.8);
}

@keyframes celebration {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    25% { transform: translate(-50%, -50%) scale(1.3) rotate(-5deg); }
    50% { transform: translate(-50%, -50%) scale(1.1) rotate(5deg); }
    75% { transform: translate(-50%, -50%) scale(1.2) rotate(-2deg); }
    100% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

/* --- Transaction Content Styling --- */
.transaction-content { display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 0.5rem; align-items: center;} /* Grid for alignment */
.transaction-amount { font-weight: 500; grid-column: 1; grid-row: 1; text-align: right; font-family: 'Fira Code', monospace;} /* Align amount right */
.transaction-desc { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; grid-column: 2; grid-row: 1; }
.transaction-date { font-size: 0.75rem; color: #718096; grid-column: 2; grid-row: 2; } /* Softer date color, below desc */

.transaction-amount.positive { color: var(--success); }
.transaction-amount.negative { color: var(--error); }

/* --- Scanner Animation --- */
.scanner {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(to right, transparent 0%, rgba(60, 130, 250, 0.1) 30%, rgba(96, 165, 250, 0.9) 50%, rgba(60, 130, 250, 0.1) 70%, transparent 100% );
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
    filter: blur(1px);
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.5);
    border-radius: 2px;
    transition: opacity 0.3s ease-out;
    z-index: 5; /* Above transactions */
}

.scanner.active {
    opacity: 1;
    animation: scan 2.5s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes scan {
    0% { transform: translateY(5px); opacity: 0.8; }
    45% { transform: translateY(calc(100% - 10px)); opacity: 1; } /* Use 100% of parent height */
    55% { transform: translateY(calc(100% - 10px)); opacity: 1; }
    95% { transform: translateY(5px); opacity: 0.8; }
    100% { transform: translateY(5px); opacity: 0.8; }
}

/* --- Power Up Animation --- */
.power-up-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 20, 40, 0.9);
    /* z-index: 10000; */ /* Original value */
    z-index: 10001; /* <<< INCREASE THIS to be > header's z-index */
    opacity: 0; /* Initially transparent */
    backdrop-filter: blur(3px);
    transition: opacity 0.5s ease-out, backdrop-filter 0.5s ease-out; /* Added backdrop filter transition */
    display: block; /* Ensure it's block */
    pointer-events: none; /* Prevent interaction when hidden */
}

.power-up-overlay.active {
    opacity: 1;
    backdrop-filter: blur(8px);
    pointer-events: auto; /* Allow interaction when active */
}
.power-up-content {
    position: absolute;
    top: 50%;
    left: calc(50% + 100px);
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(20, 30, 48, 0.97);
    border-radius: 1rem;
    padding: 2.5rem;
    width: 90%;
    max-width: 600px;
    border: 2px solid rgba(37, 99, 235, 0.3);
    box-shadow: 0 0 25px rgba(37, 99, 235, 0.25);
    color: #e2e8f0;
    transition: transform 0.4s ease-out;
    z-index: 10001;
}

/* Responsive adjustment for power-up content */
@media (max-width: 640px) {
    .power-up-content {
        left: 50%; /* Center on mobile */
        /* transform already set in base rule */
    }
}
.power-up-overlay.active .power-up-content { 
  opacity: 1; 
  transform: translate(-50%, -50%) scale(1); 
  display: block; /* Explicitly ensure display */
}

.power-text { text-align: center; margin-bottom: 2rem; }

.power-title {
    color: #fff;
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 0 15px rgba(96, 165, 250, 0.7);
    animation: pulseTextGlow 2s infinite ease-in-out;
}

@keyframes pulseTextGlow {
    0%, 100% { text-shadow: 0 0 15px rgba(96, 165, 250, 0.7), 0 0 5px rgba(255,255,255,0.5); } /* Added white core */
    50% { text-shadow: 0 0 25px rgba(96, 165, 250, 1), 0 0 10px rgba(255,255,255,0.7); }
}

.power-subtext { color: #a0aec0; font-size: 1.1rem; margin: 0.5rem 0 0; } /* Adjusted color */

.power-stats {
    background: rgba(37, 99, 235, 0.15); /* Slightly stronger bg */
    border-radius: 0.75rem; /* Match parent */
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(37, 99, 235, 0.3); /* Stronger border */
}

.stat-line { display: flex; justify-content: space-between; color: #a0aec0; margin: 0.75rem 0; font-size: 0.95rem; }
.stat-value { color: #fff; font-family: 'Fira Code', monospace; font-size: 1.1rem; font-weight: 500; }

.power-meter-container { position: relative; margin-bottom: 1.5rem; }

.power-meter {
    height: 30px;
    background: rgba(15, 23, 42, 0.6); /* Darker bg */
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(37, 99, 235, 0.4); /* Stronger border */
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.3); /* Deeper inner shadow */
}

.power-fill {
    position: absolute; top: 0; left: 0;
    height: 100%; width: 0;
    background: linear-gradient(90deg, #3b82f6, #818cf8, #a78bfa);
    transition: width 0.5s cubic-bezier(0.25, 0.8, 0.5, 1);
    border-radius: 15px;
    overflow: hidden;
}
.power-fill::after {
    content: ''; position: absolute; top: 0; left: 0;
    width: 150%; height: 100%;
    background: linear-gradient( 100deg, transparent 20%, rgba(255, 255, 255, 0.3) 50%, transparent 80% ); /* Brighter shine */
    transform: translateX(-100%);
    animation: shineFill 1.8s infinite linear; /* Slightly faster shine */
}

@keyframes shineFill { from { transform: translateX(-120%); } to { transform: translateX(120%); } } /* Adjust travel */


.power-spark {
    position: absolute; top: 50%; left: 0%;
    width: 10px; height: 30px;
    background: #fff; border-radius: 5px;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px 3px #fff, 0 0 20px 8px #a78bfa, 0 0 30px 12px rgba(37, 99, 235, 0.5);
    filter: blur(1px);
    opacity: 0.8;
    transition: left 0.15s linear; /* Keep jerky motion */
    animation: sparkPulse 0.5s infinite alternate;
    z-index: 5; /* Ensure spark is above fill */
}

@keyframes sparkPulse { from { opacity: 0.7; transform: translate(-50%, -50%) scale(0.9); } to { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } }


.power-percentage {
    text-align: center; color: #fff;
    font-size: 1.4rem; /* Bigger percentage */
    margin-top: 0.75rem;
    font-family: 'Fira Code', monospace;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(255,255,255,0.6); /* Stronger text glow */
}

/* --- Electricity Effect --- */
.electricity-effect {
    position: absolute; top: -20px; left: -20px;
    width: calc(100% + 40px); height: calc(100% + 40px);
    pointer-events: none; overflow: hidden;
    z-index: 1; /* Behind content but visible */
}

.lightning-path {
    fill: none; stroke: #a78bfa; stroke-width: 1.5px;
    opacity: 0; filter: blur(0.5px);
    stroke-dasharray: 150; /* Adjust based on typical path length */
    stroke-dashoffset: 150;
    animation: drawLightning 0.6s ease-out forwards;
}

@keyframes drawLightning {
    0% { opacity: 0.8; stroke-dashoffset: 150; stroke-width: 1.5px; }
    50% { opacity: 1; stroke-dashoffset: 0; }
    80% { opacity: 0.8; stroke-width: 1px; }
    100% { opacity: 0; stroke-dashoffset: -75; stroke-width: 0.5px; } /* Further offset */
}

/* --- Power Level Specific Styles --- */
/* Base transition on .power-up-content handles smooth changes */
.quick-scan { border-color: rgba(37, 99, 235, 0.4); box-shadow: 0 0 20px rgba(37, 99, 235, 0.2); }
.standard-power { border-color: rgba(37, 99, 235, 0.6); box-shadow: 0 0 30px rgba(37, 99, 235, 0.3); }
.enhanced-power { border-color: rgba(96, 165, 250, 0.8); box-shadow: 0 0 40px rgba(96, 165, 250, 0.4); }
.turbo-power { border-color: #a78bfa; box-shadow: 0 0 50px rgba(167, 139, 250, 0.5); }
.max-power {
    border-color: #fff;
    box-shadow: 0 0 30px 5px #fff, 0 0 50px 15px #a78bfa, 0 0 70px 25px rgba(37, 99, 235, 0.3); /* More layered glow */
    animation: power-pulse 1.5s infinite ease-in-out;
}

@keyframes power-pulse {
    0% { box-shadow: 0 0 30px 5px #fff, 0 0 50px 15px #a78bfa, 0 0 70px 25px rgba(37, 99, 235, 0.3); transform: translate(-50%, -50%) scale(1); }
    50% { box-shadow: 0 0 40px 10px #fff, 0 0 70px 20px #a78bfa, 0 0 90px 30px rgba(37, 99, 235, 0.4); transform: translate(-50%, -50%) scale(1.02); }
    100% { box-shadow: 0 0 30px 5px #fff, 0 0 50px 15px #a78bfa, 0 0 70px 25px rgba(37, 99, 235, 0.3); transform: translate(-50%, -50%) scale(1); }
}

/* --- Completion Animation --- */
.power-complete .power-fill {
    animation: complete-pulse 0.6s ease-out, shineFill 1.8s infinite linear; /* Keep shine */
}

@keyframes complete-pulse {
    0% { filter: brightness(1); transform: scaleX(1); }
    50% { filter: brightness(2) saturate(1.8); transform: scaleX(1.03); } /* More intense */
    100% { filter: brightness(1.3); transform: scaleX(1); }
}

/* --- END: Improved Animation CSS --- */


  /* Success Container */
  .success-container {
      max-width: 600px;
      margin: 2rem auto;
      background: white;
      padding: 2rem;
      border-radius: 0.75rem;
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
      text-align: center;
  }

  .success-message { margin-bottom: 2rem; }
  .success-message svg { width: 48px; height: 48px; color: #10b981; margin: 0 auto 1rem auto; display: block; } /* Centered SVG */
  .success-message h2 { font-size: 1.5rem; color: #111827; margin-bottom: 0.5rem; }
  .success-message p { color: #6b7280; font-size: 1.1rem; }

  .results-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; } /* Added wrap */
  .view-results-btn, .download-summary-btn { padding: 0.75rem 1.5rem; border-radius: 0.5rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease; border: none; }
  .view-results-btn { background: #2563eb; color: white; }
  .view-results-btn:hover { background: #1d4ed8; }
  .download-summary-btn { background: white; color: #2563eb; border: 1px solid #2563eb; }
  .download-summary-btn:hover { background: #f8fafc; }
   .view-results-btn.disabled { background-color: #cccccc; cursor: not-allowed; opacity: 0.6; }
   .view-results-btn.disabled:hover { background-color: #cccccc; } /* Prevent hover effect when disabled */


  @media (max-width: 640px) {
      .results-actions { flex-direction: column; }
      .success-container { margin: 1rem; padding: 1.5rem; }
  }

   /* Tab Navigation - Enhanced 3-way with themed colors */
  .tab-nav-container { 
    display: flex; 
    justify-content: center; 
    margin-top: 1rem;
    margin-bottom: 1rem;
  }
  .tab-nav { 
    display: inline-flex; 
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 9999px; 
    overflow: hidden; 
    padding: 6px; 
    gap: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  }
  .tab-nav button { 
    background: transparent; 
    border: none; 
    padding: 0.75rem 1.5rem; 
    font-weight: 600; 
    color: #64748b;
    transition: all 0.3s ease; 
    border-radius: 9999px; 
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  
  /* Hover effects with product themes */
  .tab-nav button.reconcileiq-tab:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
  }
  .tab-nav button.ledgeriq-tab:hover { 
    background: rgba(132, 204, 22, 0.1); 
    color: #84cc16;
  }
  .tab-nav button.codeiq-tab:hover { 
    background: rgba(168, 85, 247, 0.1); 
    color: #a855f7;
  }
  /* Attention sparkle/glow for CodeIQ tab when not active */
  .tab-nav button.codeiq-tab:not(.active) {
    position: relative;
    /* Occasional purple glow */
    animation: codeiqGlow 9s infinite ease-in-out;
  }
  .tab-nav button.codeiq-tab:not(.active)::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -30%;
    width: 40%;
    height: 200%;
    background: linear-gradient(120deg, transparent, rgba(168, 85, 247, 0.45), transparent);
    transform: rotate(25deg) translateX(-150%);
    pointer-events: none;
    filter: blur(0.2px);
    animation: codeiqSparkle 9s infinite ease-in-out;
  }
  @keyframes codeiqGlow {
    0%, 84% { box-shadow: none; }
    85%, 90% { box-shadow: 0 0 0 0 rgba(168,85,247,0), 0 0 18px rgba(168,85,247,0.35); }
    100% { box-shadow: none; }
  }
  @keyframes codeiqSparkle {
    0%, 84% { transform: rotate(25deg) translateX(-150%); opacity: 0; }
    85% { opacity: 1; }
    90% { transform: rotate(25deg) translateX(250%); opacity: 0.85; }
    100% { opacity: 0; transform: rotate(25deg) translateX(250%); }
  }
  
  /* Active states with product colors */
  .tab-nav button.reconcileiq-tab.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(37, 99, 235, 0.9));
    color: #fff;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
  }
  .tab-nav button.ledgeriq-tab.active { 
    background: linear-gradient(135deg, rgba(132, 204, 22, 0.9), rgba(101, 163, 13, 0.9));
    color: #fff;
    box-shadow: 0 2px 10px rgba(132, 204, 22, 0.3);
  }
  .tab-nav button.codeiq-tab.active { 
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.9), rgba(139, 92, 246, 0.9));
    color: #fff;
    box-shadow: 0 2px 10px rgba(168, 85, 247, 0.3);
  }
  
  .tab-nav button.active:hover { 
    transform: none; /* Keep active style on hover */
  }



/* Credits Bar */
.credits-progress-container {
    margin-bottom: 1rem;
    background: #e2e8f0; /* Slightly darker background */
    height: 8px; /* Thicker bar */
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.credits-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6b82bc 0%, var(--riq-primary) 58%, var(--riq-deep) 100%);
    border-radius: 9999px;
    transition: width 0.5s ease-out; /* Smoother transition */
}

.credits-progress-info {
    position: absolute;
    right: 0;
    top: -1.5rem; /* Adjusted position */
    font-size: 0.8rem; /* Slightly larger */
    font-weight: 500;
    color: #475569;
}

/* === Mapping Modal Styles === */

/* Currency Section */
.mapping-currency-section {
    margin-bottom: 1rem;
    text-align: center;
}
.mapping-currency-section label {
    font-weight: 600;
    margin-right: 0.5rem;
    color: #333;
}
.mapping-currency-section select {
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 1rem;
}

/* Table Containers and Wrappers */
.mapping-table-container {
    max-height: 350px; /* Taller to show more rows */
    overflow-y: auto;
}

.mapping-table-wrapper {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

/* Table Structure */
#mapping-bankTable,
#mapping-bookTable {
    table-layout: auto; /* IMPORTANT: Use auto layout only */
    width: 100%;
    border-collapse: collapse;
}

/* Table Headers and Cells */
#mapping-bankTable th,
#mapping-bankTable td,
#mapping-bookTable th,
#mapping-bookTable td {
    white-space: normal; /* Allow text wrapping */
    padding: 0.7rem 0.9rem;
    border: 1px solid #e2e8f0;
    min-width: 100px; /* Ensure minimum width for all columns */
}

/* Make headers stand out */
#mapping-bankTable th,
#mapping-bookTable th {
    background-color: #3b82f6;
    color: white;
    font-weight: 600;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Description Column - Needs More Width */
#mapping-bankTable td:nth-child(3), /* Assuming description is 3rd */
#mapping-bookTable td:nth-child(2) { /* Assuming description is 2nd */
    min-width: 250px; /* Give more space for descriptions */
    max-width: 400px;
}

/* Special handling for date and amount columns */
#mapping-bankTable td:first-child, /* Assuming date is 1st */
#mapping-bookTable td:first-child { /* Assuming date is 1st */
    min-width: 100px; /* Date columns */
    width: 100px;
}

/* Specific Style Correction (If Amount column was meant) */
#mapping-bankTable td.amount-column, /* Use class if possible */
#mapping-bookTable td.amount-column {
    min-width: 120px;
    max-width: 150px;
    text-align: right;
}

    /* Premium Notification */
    .premium-notification {
        color: #dd6b20; /* Orange color */
        font-size: 0.9rem; /* Adjusted size */
        font-weight: 500;
        margin-top: 1rem; /* Spacing */
        text-align: center;
        background-color: #feebc8; /* Light orange background */
        padding: 0.5rem;
        border-radius: 0.375rem;
        border: 1px solid #fbd38d; /* Orange border */
    }

    /* Credit Card Option in Mapping Modal */
  .credit-card-option {
    margin: 10px 0 15px 0;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
    border-radius: 4px;
    display: flex; /* Align items */
    align-items: flex-start; /* Align checkbox top */
  }
  .credit-card-option input[type="checkbox"] {
    margin-right: 8px;
    margin-top: 2px; /* Align checkbox better */
    flex-shrink: 0; /* Prevent checkbox shrinking */
  }
  .credit-card-option label {
    font-weight: 500;
    cursor: pointer;
    flex-grow: 1; /* Allow label text to take space */
    line-height: 1.3; /* Improve line spacing */
  }
  .credit-card-option .help-text {
    display: block;
    margin-top: 4px;
    font-weight: normal;
    font-size: 0.9em;
    color: #6c757d;
  }

  /* Styles for Credentials Modal */
#subAccountCredentialsModal .modal-content {
    border-left: 5px solid var(--success); /* Add a success indicator */
}

#subAccountCredentialsModal code {
   font-size: 1rem; /* Make password slightly larger */
   letter-spacing: 0.05em;
}

#copyPasswordBtn {
    background-color: var(--neutral-100);
    border: 1px solid var(--neutral-300);
    color: var(--neutral-700);
}
#copyPasswordBtn:hover {
     background-color: var(--neutral-200);
}

/* Overlay for mobile sidebar */
#sidebarOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9997; /* Below sidebar */
    display: none; /* Hidden by default */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}
#sidebarOverlay.active {
    display: block;
    opacity: 1;
}




/* ============================================
   EDITORIAL REDESIGN OVERRIDES
   (merged from tool-redesign.css)
   ============================================ */

/**
 * ReconcileIQ Tool - Editorial Redesign
 * Warm cream palette, Fraunces serif headlines, DM Sans body,
 * hue-tinted product colors, grain texture, rule-line dividers.
 *
 * Consumes tokens from iq-suite-editorial.css
 * Overrides tool-base.css
 */

/* ============================================
   CSS CUSTOM PROPERTIES (override base)
   ============================================ */
:root {
    /* Map old blue tokens to editorial palette */
    --riq-blue-50: var(--riq-light);
    --riq-blue-100: var(--riq-light);
    --riq-blue-200: #c8cedf;
    --riq-blue-300: #a3aecb;
    --riq-blue-400: #7d8db7;
    --riq-blue-500: var(--riq-primary);
    --riq-blue-600: var(--riq-primary);
    --riq-blue-700: var(--riq-deep);
    --riq-blue-800: var(--riq-deep);
    --riq-blue-900: #2c3a5e;

    /* Map old gray tokens to warm cream tones */
    --riq-gray-50: var(--cream);
    --riq-gray-100: var(--ivory);
    --riq-gray-200: var(--rule);
    --riq-gray-300: #c4c0b8;
    --riq-gray-400: var(--ink-subtle);
    --riq-gray-500: var(--ink-muted);
    --riq-gray-600: var(--ink-light);
    --riq-gray-700: var(--ink-light);
    --riq-gray-800: var(--ink);
    --riq-gray-900: var(--ink);

    /* Status Colors - keep */
    --riq-success: var(--ed-success);
    --riq-success-light: var(--ed-success-light);
    --riq-warning: var(--ed-warning);
    --riq-warning-light: var(--ed-warning-light);
    --riq-error: var(--ed-error);
    --riq-error-light: var(--ed-error-light);

    /* Typography - switch to editorial */
    --riq-font-sans: var(--ed-font-sans);
    --riq-font-mono: var(--ed-font-mono);

    /* Spacing - keep */
    --riq-space-1: 4px;
    --riq-space-2: 8px;
    --riq-space-3: 12px;
    --riq-space-4: 16px;
    --riq-space-5: 20px;
    --riq-space-6: 24px;
    --riq-space-8: 32px;
    --riq-space-10: 40px;
    --riq-space-12: 48px;

    /* Shadows - lighter, less dramatic */
    --riq-shadow-sm: var(--ed-shadow-sm);
    --riq-shadow-md: var(--ed-shadow-md);
    --riq-shadow-lg: var(--ed-shadow-lg);
    --riq-shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.08);

    /* Border Radius - tight editorial */
    --riq-radius-sm: 4px;
    --riq-radius-md: 4px;
    --riq-radius-lg: 4px;
    --riq-radius-xl: 4px;
}

/* ============================================
   BASE RESETS & BODY
   ============================================ */
body {
    font-family: var(--ed-font-sans);
    background: var(--cream);
    color: var(--ink);
    padding-top: 56px;
}

/* ============================================
   TOP BAR - EDITORIAL MASTHEAD
   ============================================ */
header.top-bar {
    height: 56px;
    background: #fff;
    color: var(--ink);
    border-bottom: 1px solid var(--rule);
    box-shadow: none;
    padding: 0 24px;
}

header.top-bar::before {
    display: none;
}

header.top-bar .brand {
    font-family: var(--ed-font-serif);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.3px;
}

header.top-bar .brand a {
    color: var(--ink);
}

/* Navigation Links */
header.top-bar nav.top-nav {
    padding-left: 0;
}

header.top-bar nav.top-nav a {
    font-family: var(--ed-font-sans);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--ed-radius);
    color: var(--ink-light);
    transition: all 0.15s ease;
}

header.top-bar nav.top-nav a:hover {
    background: var(--ivory);
    color: var(--ink);
}

/* Buy Credits / Upgrade Buttons */
header.top-bar nav.top-nav a#buyCredits,
header.top-bar nav.top-nav a#upgradeButton {
    background: var(--ivory);
    border: 1px solid var(--rule);
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
}

header.top-bar nav.top-nav a#buyCredits:hover,
header.top-bar nav.top-nav a#upgradeButton:hover {
    background: var(--paper);
    border-color: var(--ink-subtle);
    color: var(--ink);
}

/* ============================================
   SIDEBAR - CREAM EDITORIAL
   ============================================ */
.sidebar {
    position: fixed;
    left: -280px;
    top: 56px;
    width: 280px;
    height: calc(100vh - 56px);
    background: var(--cream);
    border-right: 1px solid var(--rule);
    z-index: 9998;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--ed-shadow-lg);
    padding: 24px;
}

.sidebar.active {
    left: 0;
}

.sidebar .logo-section {
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--rule);
}

.sidebar .logo-title {
    font-family: var(--ed-font-serif);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    text-transform: none;
    letter-spacing: -0.2px;
}

.sidebar .nav-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--ed-radius);
    color: var(--ink-muted);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
    text-decoration: none;
}

.sidebar .nav-link:hover {
    background: var(--ivory);
    color: var(--ink);
}

.sidebar .support-link {
    margin-top: 24px;
    background: var(--riq-primary);
    color: white;
    text-align: center;
    border-radius: var(--ed-radius);
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    display: flex;
    position: fixed;
    top: 68px;
    left: 16px;
    width: 36px;
    height: 36px;
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10001;
    box-shadow: var(--ed-shadow-sm);
    transition: all 0.15s ease;
}

.sidebar-toggle:hover {
    background: var(--ivory);
    border-color: var(--ink-subtle);
}

.sidebar-toggle i,
.sidebar-toggle svg {
    width: 18px;
    height: 18px;
    color: var(--ink-muted);
}

/* Mobile menu toggle - editorial override */
.mobile-menu-toggle {
    color: var(--ink-muted);
}

/* Sidebar Overlay */
#sidebarOverlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.3);
    backdrop-filter: blur(4px);
    z-index: 9997;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#sidebarOverlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: 0;
    padding: 32px;
    padding-left: calc(32px + 52px);
    background: var(--cream);
    min-height: calc(100vh - 56px);
    border-radius: 0;
}

.tool-container {
    max-width: 1000px;
    margin: 0 auto;
}

.container {
    padding: 0;
    margin: 0;
    max-width: none;
}

/* ============================================
   HEADER SECTION
   ============================================ */
.header {
    text-align: center;
    margin-bottom: 32px;
    padding: 0;
}

.header-image {
    max-width: 280px;
    margin-bottom: 16px;
}

.header-title {
    font-family: var(--ed-font-serif);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.header-description {
    font-size: 1rem;
    color: var(--ink-muted);
    font-weight: 400;
}

/* Instructions Button */
.guide-button {
    background: #fff;
    color: var(--riq-primary);
    border: 1px solid var(--rule);
    padding: 10px 20px;
    border-radius: var(--ed-radius);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: all 0.15s ease;
    margin-top: 16px;
}

.guide-button:hover {
    background: var(--ivory);
    border-color: var(--ink-subtle);
    color: var(--riq-deep);
    transform: none;
    box-shadow: none;
}

/* ============================================
   REFERRAL BANNER
   ============================================ */
.main-content > .tool-container > .container > div[style*="background-color: #e6fffa"] {
    background: var(--ed-success-light);
    border: 1px solid rgba(5, 150, 105, 0.2);
    border-radius: var(--ed-radius);
    padding: 12px 16px;
    margin-bottom: 24px;
}

.main-content > .tool-container > .container > div[style*="background-color: #e6fffa"] a {
    color: var(--ed-success);
    font-size: 14px;
    font-weight: 500;
}

/* ============================================
   INPUT SECTION - EDITORIAL CARD
   ============================================ */
.input-section {
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: var(--ed-radius);
    padding: 32px;
    box-shadow: none;
    position: relative;
}

.input-section:hover {
    transform: none;
    box-shadow: none;
}

/* View History Tab */
.view-history-tab {
    position: absolute;
    top: -1px;
    left: 24px;
    background: var(--ivory);
    border: 1px solid var(--rule);
    border-bottom: 1px solid #fff;
    border-radius: var(--ed-radius) var(--ed-radius) 0 0;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-muted);
    transition: all 0.15s ease;
    box-shadow: none;
    backdrop-filter: none;
}

.view-history-tab:hover {
    background: var(--riq-light);
    color: var(--riq-deep);
    transform: none;
    box-shadow: none;
}

/* ============================================
   CREDIT STATUS
   ============================================ */
.credit-status {
    background: var(--ivory);
    border: 1px solid var(--rule);
    border-radius: var(--ed-radius);
    padding: 20px;
    margin-bottom: 24px;
}

.credits-progress-container {
    position: relative;
    background: var(--paper);
    border-radius: 3px;
    height: 6px;
    overflow: visible;
    margin-bottom: 28px;
}

.credits-progress-bar {
    background: linear-gradient(90deg, #6b82bc 0%, var(--riq-primary) 58%, var(--riq-deep) 100%);
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
    overflow: hidden;
}

.credits-progress-info {
    position: absolute;
    right: 0;
    top: -10px;
}

#creditsProgressText {
    font-family: var(--ed-font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-muted);
    background: #fff;
    padding: 2px 8px;
    border-radius: var(--ed-radius);
    border: 1px solid var(--rule);
}

.credit-counts {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.credit-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.credit-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--ink-subtle);
}

.credit-value {
    font-family: var(--ed-font-mono);
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}

#monthlyCredits,
#creditsUsed,
#bonusCredits {
    font-family: var(--ed-font-mono);
    font-weight: 700;
    color: var(--riq-deep);
}

/* ============================================
   FILE UPLOAD SECTION
   ============================================ */
.file-upload-section {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 24px;
}

.file-upload-section:hover {
    transform: none;
    box-shadow: none;
}

.file-upload-section::before {
    display: none;
}

/* PDF Toggle Link */
.pdf-toggle-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--riq-light);
    border: 1px solid #c8cedf;
    border-radius: var(--ed-radius);
    color: var(--riq-deep);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    transition: all 0.15s ease;
    box-shadow: none;
}

.pdf-toggle-link:hover {
    background: #dde1ee;
    border-color: var(--riq-primary);
    transform: none;
    box-shadow: none;
}

/* File Label - Drop Zone */
.file-label {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: #fff;
    border: 2px dashed var(--rule);
    border-radius: var(--ed-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
}

.file-label:hover {
    border-color: var(--riq-primary);
    background: var(--riq-light);
    transform: none;
    box-shadow: none;
}

.file-label.drag-over {
    border-color: var(--riq-primary);
    background: var(--riq-light);
    transform: none;
    box-shadow: 0 0 0 3px rgba(91, 110, 174, 0.15);
}

.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ivory);
    border-radius: var(--ed-radius);
    margin-right: 16px;
    color: var(--ink-muted);
}

.file-icon i {
    width: 20px;
    height: 20px;
}

.file-text {
    flex: 1;
    font-size: 14px;
    color: var(--ink-muted);
    font-weight: 500;
}

.file-button {
    background: var(--riq-primary);
    color: white;
    padding: 8px 16px;
    border-radius: var(--ed-radius);
    font-size: 13px;
    font-weight: 600;
    border: none;
    box-shadow: none;
    transition: background 0.15s ease;
}

.file-label:hover .file-button {
    background: var(--riq-deep);
    transform: none;
    box-shadow: none;
}

.file-name {
    font-family: var(--ed-font-mono);
    font-size: 13px;
    color: var(--ink-subtle);
    margin-top: 8px;
    padding-left: 56px;
}

/* ============================================
   MODE SELECTOR
   ============================================ */
.mode-selector {
    display: flex;
    background: var(--ivory);
    border: 1px solid var(--rule);
    border-radius: var(--ed-radius-pill);
    padding: 4px;
    margin: 24px 0;
    box-shadow: none;
    backdrop-filter: none;
}

.mode-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--ed-radius-pill);
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    color: var(--ink-muted);
    font-size: 14px;
    font-weight: 500;
}

.mode-option:hover:not(.active) {
    background: rgba(255, 255, 255, 0.6);
    color: var(--ink);
    transform: none;
    box-shadow: none;
}

.mode-option.active {
    background: #fff;
    color: var(--ink);
    font-weight: 600;
    box-shadow: var(--ed-shadow-sm);
    transform: none;
    border: 1px solid var(--rule);
}

.mode-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rule);
    margin-right: 0;
    transition: all 0.2s ease;
    box-shadow: none;
}

#bankModeOption.active .mode-indicator {
    background: var(--riq-primary);
    box-shadow: 0 0 0 3px rgba(91, 110, 174, 0.2);
    animation: none;
}

#invoiceModeOption.active .mode-indicator {
    background: var(--ed-success);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
    animation: none;
}

/* ============================================
   EXPLANATION BANNER
   ============================================ */
.explanation-banner {
    background: var(--riq-light);
    border: 1px solid #c8cedf;
    border-radius: var(--ed-radius);
    padding: 20px;
    margin: 16px 0 24px 0;
    box-shadow: none;
    backdrop-filter: none;
    animation: none;
}

.banner-icon {
    background: var(--riq-primary);
    border-radius: var(--ed-radius);
    box-shadow: none;
}

.banner-content h4 {
    font-family: var(--ed-font-serif);
    color: var(--riq-deep);
    font-size: 15px;
    font-weight: 600;
}

.banner-content p {
    color: var(--ink-muted);
    font-size: 13px;
}

.criteria-item {
    background: #fff;
    border: 1px solid #c8cedf;
    border-left: 3px solid var(--riq-primary);
    border-radius: var(--ed-radius);
    padding: 8px 12px;
    font-size: 13px;
    color: var(--ink-light);
}

/* ============================================
   RECONCILE BUTTON - PRIMARY ACTION
   ============================================ */
.reconcile-button {
    width: 100%;
    padding: 14px;
    background: var(--riq-primary);
    color: white;
    border: none;
    border-radius: var(--ed-radius);
    font-family: var(--ed-font-sans);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.reconcile-button:hover {
    background: var(--riq-deep);
    transform: none;
    box-shadow: none;
}

.reconcile-button:active {
    transform: translateY(1px);
}

.reconcile-button i {
    width: 18px;
    height: 18px;
}

/* ============================================
   TAB NAVIGATION - EDITORIAL PILLS
   ============================================ */
.tab-nav-container {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.tab-nav {
    display: inline-flex;
    background: var(--ivory);
    border: 1px solid var(--rule);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: var(--ed-radius-pill);
    overflow: hidden;
    padding: 4px;
    gap: 4px;
    box-shadow: none;
}

.tab-nav button {
    background: transparent;
    border: none;
    padding: 8px 20px;
    font-family: var(--ed-font-sans);
    font-weight: 500;
    font-size: 13px;
    color: var(--ink-muted);
    transition: all 0.2s ease;
    border-radius: var(--ed-radius-pill);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Hover effects with editorial product themes */
.tab-nav button.reconcileiq-tab:hover {
    background: var(--riq-light);
    color: var(--riq-primary);
}

.tab-nav button.ledgeriq-tab:hover {
    background: var(--liq-light);
    color: var(--liq-primary);
}

.tab-nav button.codeiq-tab:hover {
    background: var(--ciq-light);
    color: var(--ciq-primary);
}

/* Active states with editorial product colors */
.tab-nav button.reconcileiq-tab.active {
    background: var(--riq-primary);
    color: #fff;
    box-shadow: none;
}

.tab-nav button.ledgeriq-tab.active {
    background: var(--liq-primary);
    color: #fff;
    box-shadow: none;
}

.tab-nav button.codeiq-tab.active {
    background: var(--ciq-primary);
    color: #fff;
    box-shadow: none;
}

.tab-nav button.active:hover {
    transform: none;
}

/* ============================================
   MERCHANT PARSER BUTTON
   ============================================ */
.merchant-parser-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--riq-primary, #5b6eae), var(--riq-deep, #3d4d7a));
    border-radius: var(--ed-radius-pill, 999px);
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 10px 24px -16px rgba(61, 77, 122, 0.9);
    color: #fff;
    border: 1px solid rgba(61, 77, 122, 0.35);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.merchant-parser-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px -16px rgba(61, 77, 122, 1);
    filter: saturate(1.08);
}

.merchant-parser-btn:active {
    transform: translateY(0);
    box-shadow: 0 8px 20px -16px rgba(61, 77, 122, 0.9);
}

.merchant-parser-btn i {
    width: 14px;
    height: 14px;
}

/* ============================================
   RESULTS AREA
   ============================================ */
#results {
    margin-top: 32px;
}

.result-section {
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: var(--ed-radius);
    padding: 24px;
    box-shadow: none;
}

.result-section h2 {
    font-family: var(--ed-font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ink);
    border-bottom: 1px solid var(--rule);
}

/* Table Styling */
table {
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background: var(--riq-deep);
    font-family: var(--ed-font-sans);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 16px;
    color: #fff;
}

td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--ivory);
    color: var(--ink);
}

td:nth-child(2),
td:nth-child(3) {
    font-family: var(--ed-font-mono);
}

tr:hover td {
    background: var(--ivory);
}

/* ============================================
   SEARCH INPUT
   ============================================ */
#searchInput {
    border: 1px solid var(--rule);
    border-radius: var(--ed-radius);
    padding: 10px 16px;
    font-size: 14px;
    font-family: var(--ed-font-sans);
    transition: all 0.15s ease;
}

#searchInput:focus {
    border-color: var(--riq-primary);
    box-shadow: 0 0 0 3px rgba(91, 110, 174, 0.15);
    outline: none;
}

/* ============================================
   MODALS - EDITORIAL
   ============================================ */
.modal-content {
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: var(--ed-radius);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
    padding: 32px;
}

.modal-content h2 {
    font-family: var(--ed-font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ink);
}

.close-btn {
    background: var(--ivory);
    border: 1px solid var(--rule);
    border-radius: 50%;
    transition: all 0.15s ease;
}

.close-btn:hover {
    background: var(--paper);
}

/* ============================================
   PDF CONVERTER SECTION
   ============================================ */
.pdf-converter-section {
    background: var(--riq-light);
    border: 1px solid #c8cedf;
    border-radius: var(--ed-radius);
}

.pdf-upload-area {
    background: #fff;
    border: 2px dashed var(--rule);
    border-radius: var(--ed-radius);
}

.pdf-upload-area:hover {
    border-color: var(--riq-primary);
    background: var(--riq-light);
}

.pdf-btn {
    border-radius: var(--ed-radius);
    font-weight: 600;
}

.pdf-btn-primary {
    background: var(--riq-primary);
}

.pdf-btn-primary:hover:not(:disabled) {
    background: var(--riq-deep);
}

.pdf-btn-success {
    background: var(--ed-success);
}

.pdf-stats {
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: var(--ed-radius);
}

.pdf-stat-number {
    font-family: var(--ed-font-mono);
    font-weight: 700;
    color: var(--riq-deep);
}

.pdf-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ink-subtle);
}

/* ============================================
   PROGRESS BAR
   ============================================ */
#progressContainer > div:first-child {
    background: var(--paper);
    border-radius: 3px;
}

#progressBar {
    background: linear-gradient(90deg, var(--riq-primary), var(--riq-deep));
    border-radius: 3px;
}

#progressText {
    font-family: var(--ed-font-mono);
    font-size: 13px;
    color: var(--ink-muted);
}

/* ============================================
   ERROR MESSAGES
   ============================================ */
.error,
#error {
    background: var(--ed-error-light);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: var(--ed-radius);
    color: var(--ed-error);
    font-weight: 500;
}

/* ============================================
   TIER DISPLAY
   ============================================ */
.tier-display {
    margin: 16px auto;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    body {
        padding-top: 56px;
    }

    header.top-bar {
        height: 56px;
    }

    .sidebar {
        top: 56px;
        height: calc(100vh - 56px);
    }

    .sidebar-toggle {
        top: 68px;
    }

    .main-content {
        padding: 16px;
        padding-left: 16px;
        padding-top: 64px;
    }

    .input-section {
        padding: 20px;
    }

    .mode-option {
        padding: 8px 12px;
        font-size: 13px;
    }

    .credit-counts {
        flex-direction: column;
        gap: 12px;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.input-section,
.file-label,
.reconcile-button,
.mode-option {
    animation: none;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none;
        transition: none;
    }
}

/* ============================================
   INLINE STYLE REPLACEMENTS (Phase 5)
   ============================================ */

/* Merchant parser container positioning */
.merchant-parser-container {
    position: relative;
    margin-bottom: 1rem;
}

/* Brand link reset */
.brand a {
    text-decoration: none;
    color: inherit;
}

/* Header user info area */
#userInfo {
    padding: 0.5rem 0.8rem;
    color: white;
}

#userGreeting {
    display: block;
    margin-bottom: 0.3rem;
}

#logoutLink {
    color: var(--ink);
    padding: 0.3rem 0.6rem;
    border-radius: var(--ed-radius);
    background: rgba(0, 0, 0, 0.06);
    text-decoration: none;
}

#logoutLink:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Settings icon link */
#userSettingsIcon {
    color: var(--ink-muted);
    padding: 8px;
}

#userSettingsIcon i,
#userSettingsIcon svg {
    width: 24px;
    height: 24px;
}

/* Language selector - editorial overrides for JS-injected dark-theme styles */
header.top-bar .lang-toggle {
    background: var(--ivory);
    border: 1px solid var(--rule);
}

header.top-bar .lang-toggle:hover {
    background: var(--paper);
    border-color: var(--ink-subtle);
}

header.top-bar .lang-chevron {
    color: var(--ink-muted);
}

/* Icon sizing (inline replacements) */
.icon-inline {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    margin-right: 0.3em;
}

.icon-inline-search {
    width: 1em;
    height: 1em;
    vertical-align: middle;
    margin-right: 0.25em;
}

.icon-inline-btn {
    width: 1em;
    height: 1em;
    vertical-align: middle;
    margin-right: 0.3em;
}

.icon-18 {
    width: 18px;
    height: 18px;
}

.icon-16 {
    width: 16px;
    height: 16px;
}

.icon-14 {
    width: 14px;
    height: 14px;
}

.icon-12 {
    width: 12px;
    height: 12px;
}

.icon-20 {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.icon-32 {
    width: 32px;
    height: 32px;
}

.icon-2rem {
    width: 2rem;
    height: 2rem;
}

/* Register modal elements */
#passwordStrength {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--ink-muted);
}

.modal-form .form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.modal-form .btn-cancel {
    background-color: var(--ink-subtle);
}

#registerError {
    color: var(--ed-error);
    margin-top: 1rem;
    text-align: center;
}

/* Tour button */
.btn-tour {
    margin-left: 0.5rem;
}

/* Referral banner - editorial warm tones */
.referral-banner {
    margin-bottom: 1.5rem;
    background-color: var(--liq-light);
    border: 1px solid var(--liq-primary);
    border-radius: var(--ed-radius);
    padding: 0.75rem 1rem;
    text-align: center;
    box-shadow: var(--ed-shadow-sm);
    transition: all 0.2s ease;
}

.referral-banner a {
    color: var(--liq-deep);
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* PDF converter elements */
.beta-badge {
    color: var(--ed-warning);
}

.beta-warning {
    text-align: center;
    color: var(--ed-warning);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.credit-cost-notice {
    margin: 1rem auto;
    max-width: 600px;
    padding: 0.75rem 1rem;
    background: var(--ed-warning-light);
    border: 1px solid var(--ed-warning);
    border-radius: var(--ed-radius);
    box-shadow: var(--ed-shadow-sm);
}

.credit-cost-notice-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #92400e;
    justify-content: center;
}

.credit-cost-notice-inner span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* PDF upload prompts */
.pdf-upload-icon {
    color: var(--ink-muted);
    margin-bottom: 0.5rem;
}

.pdf-download-icon {
    color: var(--ed-success);
    margin-bottom: 0.5rem;
}

.pdf-use-icon {
    color: var(--riq-primary);
    margin-bottom: 0.5rem;
}

.pdf-upload-text {
    margin: 0;
    color: var(--ink-light);
    font-weight: 500;
}

.pdf-upload-subtext {
    margin: 0.25rem 0 0 0;
    font-size: 0.875rem;
    color: var(--ink-muted);
}

/* PDF success compartment text */
.pdf-download-text {
    margin: 0;
    color: var(--ed-success);
    font-weight: 600;
}

.pdf-download-subtext {
    margin: 0.25rem 0 0 0;
    font-size: 0.75rem;
    color: var(--ed-success);
}

.pdf-use-text {
    margin: 0;
    color: var(--riq-deep);
    font-weight: 600;
}

.pdf-use-subtext {
    margin: 0.25rem 0 0 0;
    font-size: 0.75rem;
    color: var(--riq-primary);
}

/* PDF progress text */
.pdf-progress-text {
    text-align: center;
    margin: 0.5rem 0;
    color: var(--ink-light);
    font-size: 0.875rem;
}

/* Progress bar (reconciliation) */
.progress-track {
    background: var(--paper);
    height: 8px;
    border-radius: var(--ed-radius);
    overflow: hidden;
}

.progress-fill {
    background: var(--riq-primary);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-label {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--ink-muted);
}

/* Search input area */
#tableSearch {
    margin: 1.5rem 0;
    text-align: center;
}

#tableSearch label {
    font-weight: 600;
    color: var(--riq-deep);
    margin-right: 0.5rem;
}

#searchInput {
    width: 70%;
    max-width: 400px;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--rule);
    border-radius: var(--ed-radius);
    font-weight: 500;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--ed-font-sans);
}

#searchInput:focus {
    border-color: var(--riq-primary);
    box-shadow: 0 0 0 2px var(--riq-light);
    outline: none;
}

/* Instructions modal explainer */
.explainer {
    padding: 1rem;
    background: var(--ivory);
    border-radius: var(--ed-radius);
    margin-bottom: 1rem;
    font-family: var(--ed-font-sans);
    color: var(--ink-light);
}

.explainer h3 {
    margin-top: 0;
    color: var(--riq-deep);
}

.explainer ul {
    list-style: disc;
    margin-left: 1.5rem;
}

.explainer details {
    margin-top: 1rem;
}

.explainer summary {
    cursor: pointer;
    color: var(--riq-primary);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.explainer h4 {
    margin-top: 0.5rem;
}

.explainer details ul {
    list-style: circle;
    margin-left: 1.5rem;
}

/* Instructions content box */
#instructionsContent {
    color: var(--ink-light);
    border: 1px solid var(--rule);
    padding: 1rem;
    border-radius: var(--ed-radius);
    background-color: var(--cream);
    max-height: 200px;
    overflow-y: auto;
}

/* Overage settings section */
.overage-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
}

.overage-section h4 {
    color: var(--ink-light);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.overage-control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--cream);
    border-radius: var(--ed-radius-lg);
    margin-bottom: 0.5rem;
}

.overage-control-row > div {
    flex: 1;
}

.overage-control-row .overage-label {
    font-size: 0.85rem;
    color: var(--ink-light);
}

#overageRateInfo {
    font-size: 0.75rem;
    color: var(--ink-muted);
    margin-top: 0.25rem;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--rule);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--riq-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

#overageWarning {
    font-size: 0.75rem;
    color: #b45309;
    background: var(--ed-warning-light);
    padding: 0.5rem;
    border-radius: var(--ed-radius);
    margin-top: 0.5rem;
}

/* User account message */
#userAccountMessage {
    margin-top: 1rem;
    text-align: center;
}

/* Payment modal text colors */
#paymentModal .modal-content p {
    color: var(--ink-muted);
}

#paymentModal .modal-content label {
    color: var(--ink-light);
}

#paymentModal #creditSelect {
    color: var(--ink-light);
    border-color: var(--rule);
    background: white;
}

#paymentError {
    color: var(--ed-error);
    text-align: center;
}

/* Date format modal editorial overrides */
#dateFormatModal .validation-modal-container {
    max-width: 520px;
}

#dateFormatModal .validation-icon-container i {
    color: var(--riq-primary);
    width: 32px;
    height: 32px;
}

.date-format-intro {
    margin: 0 0 1.25rem;
    color: var(--ink-light);
    font-size: 1rem;
}

.date-format-intro strong {
    color: var(--riq-primary);
}

.date-format-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.date-format-option {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    border: 3px solid var(--rule);
    border-radius: var(--ed-radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--cream);
}

.date-format-option input[type="radio"] {
    margin-top: 4px;
    accent-color: var(--riq-primary);
    width: 18px;
    height: 18px;
}

.date-format-option strong {
    color: var(--ink);
    font-size: 1.05rem;
}

.date-format-option .format-example {
    color: var(--ink-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.date-format-option .format-example strong {
    color: var(--liq-deep);
}

.date-format-tip {
    background: var(--riq-light);
    border: 2px solid var(--riq-primary);
    border-radius: var(--ed-radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.date-format-tip i {
    color: var(--riq-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.date-format-tip p {
    margin: 0;
    color: var(--ink-light);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Sub-Account Credentials Modal */
#subAccountCredentialsModal .modal-content {
    max-width: 500px;
}

.credentials-title {
    color: var(--ed-success);
    margin-bottom: 1rem;
}

.credentials-intro {
    margin-bottom: 1.5rem;
}

.credential-group {
    margin-bottom: 1rem;
}

.credential-label {
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

.credential-value {
    font-family: var(--ed-font-mono);
    background-color: var(--ivory);
    padding: 0.3rem 0.6rem;
    border-radius: var(--ed-radius);
    display: inline-block;
}

.credential-password-group {
    margin-bottom: 1.5rem;
}

.credential-password-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.credential-password {
    font-family: var(--ed-font-mono);
    background-color: var(--paper);
    padding: 0.5rem 0.8rem;
    border-radius: var(--ed-radius);
    flex-grow: 1;
    overflow-wrap: break-word;
}

.btn-copy {
    padding: 0.5rem 0.8rem;
    flex-shrink: 0;
}

#copyFeedback {
    display: block;
    margin-top: 0.5rem;
    color: var(--ed-success);
    transition: opacity 0.3s ease;
}

.btn-modal-close {
    width: 100%;
    margin-top: 1rem;
}

/* PDF Verification Modal overrides */
#pdfVerificationModal .login-required-icon {
    background: linear-gradient(135deg, var(--ed-warning) 0%, #b45309 100%);
}

.pdf-verify-warning {
    background: var(--ed-warning-light);
    border: 1px solid var(--ed-warning);
    border-radius: var(--ed-radius-lg);
    padding: 1rem;
    margin: 1.5rem 0;
}

.pdf-verify-warning p {
    color: #92400e;
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
}

.pdf-verify-checkbox {
    margin: 1.5rem 0;
}

.pdf-verify-checkbox label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    user-select: none;
}

.pdf-verify-checkbox input[type="checkbox"] {
    margin-top: 2px;
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.pdf-verify-checkbox span {
    color: var(--ink-light);
    font-size: 0.875rem;
    line-height: 1.5;
}

.btn-disabled-state {
    opacity: 0.5;
    cursor: not-allowed;
}

.info-icon-inline {
    display: inline;
    vertical-align: middle;
    margin-right: 4px;
}

/* Validation modal JS-injected error heading */
.validation-error-heading {
    color: #D32F2F;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.validation-error-box {
    background: #FFEBEE;
    border: 2px solid #EF5350;
    border-radius: var(--ed-radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
}

.validation-error-box p {
    color: #C62828;
    font-weight: 600;
    margin: 0;
}

.validation-warning-heading {
    color: #00838F;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.validation-list-item {
    margin-left: 1rem;
}

/* JS-generated success/results elements */
.success-icon-block {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem auto;
    display: block;
}

.success-icon-block.primary {
    color: var(--riq-primary);
}

.success-icon-block.success {
    color: var(--ed-success);
}

.success-status-text {
    color: var(--riq-primary);
    margin: 1rem 0;
}

.success-detail-text {
    color: var(--ink-muted);
    font-size: 0.9rem;
}

.success-detail-text.success {
    color: var(--ed-success);
    margin-top: 0.5rem;
}

.btn-retry {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--riq-primary);
    color: white;
    border: none;
    border-radius: var(--ed-radius);
    cursor: pointer;
    font-family: var(--ed-font-sans);
}

.btn-retry:hover {
    background: var(--riq-deep);
}

.performance-note {
    color: var(--ink-muted);
}

.view-analysis-btn {
    background: var(--riq-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--ed-radius);
    cursor: pointer;
    font-family: var(--ed-font-sans);
}

.view-analysis-btn:hover {
    background: var(--riq-deep);
}

.view-analysis-btn svg {
    width: 20px;
    height: 20px;
    display: inline-block;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* PDF Accuracy Warning Modal */
.pdf-accuracy-warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pdfWarningFadeIn 0.3s ease;
}

@keyframes pdfWarningFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pdfWarningSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pdfWarningPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pdf-accuracy-warning-modal {
    background: #fff;
    border-radius: 16px;
    max-width: 460px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: pdfWarningSlideUp 0.35s ease;
    overflow: hidden;
}

.pdf-accuracy-warning-header {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pdf-accuracy-warning-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.4);
    object-fit: cover;
    animation: pdfWarningPulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

.pdf-accuracy-warning-header-text h3 {
    margin: 0;
    color: #fff;
    font-family: var(--ed-font-serif, 'Fraunces', serif);
    font-size: 1.2rem;
    font-weight: 700;
}

.pdf-accuracy-warning-header-text p {
    margin: 0.15rem 0 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.82rem;
}

.pdf-accuracy-warning-body {
    padding: 1.5rem;
}

.pdf-accuracy-warning-icon {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    color: #d97706;
    font-weight: 600;
    font-size: 0.95rem;
}

.pdf-accuracy-warning-icon svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.pdf-accuracy-warning-body p {
    margin: 0 0 1rem;
    color: #374151;
    font-size: 0.9rem;
    line-height: 1.6;
}

.pdf-accuracy-warning-tip {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    color: #92400e;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.pdf-accuracy-warning-tip strong {
    color: #78350f;
}

.pdf-accuracy-warning-dismiss {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--ed-font-sans, 'DM Sans', sans-serif);
}

.pdf-accuracy-warning-dismiss:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}
