/* =========================================
   GLOBAL VARIABLES & RESET
   ========================================= */
:root {
    --primary: #005baa;       /* Deep Professional Blue */
    --primary-dark: #003d73;
    --accent: #7ab800;        /* Action Green */
    --accent-dark: #5c8a00;
    --bg-main: #f8fafc;       /* Very light, crisp blue-gray background */
    --bg-card: #ffffff;
    --text-main: #1e293b;     /* Very dark slate for high readability */
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --max-width: 1200px;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img,
svg {
    max-width: 100%;
}

/* =========================================
   TYPOGRAPHY
   ========================================= */
h1, h2, h3 {
    line-height: 1.2;
    color: var(--primary);
    font-weight: 800;
}

h1 { font-size: 3.5rem; margin-bottom: 1.5rem; }
h2 { font-size: 2.5rem; margin-bottom: 1rem; }
p { font-size: 1.125rem; margin-bottom: 1.5rem; color: var(--text-muted); }

/* =========================================
   LAYOUT & CONTAINERS
   ========================================= */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 6rem 0;
}

/* =========================================
   NAVIGATION BAR
   ========================================= */
nav {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 80px;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

.nav-brand-and-links {
    display: flex;
    align-items: center;
    gap: 30px;
}

.logo img {
    height: 100px;
    display: block;
    width: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.nav-active {
    color: var(--primary);
}

/* Nav: short labels for mobile only (TOS, Privacy) */
.nav-link-short {
    display: none;
}
@media (max-width: 768px) {
    .nav-links .nav-link-full {
        display: none;
    }
    .nav-links .nav-link-short {
        display: inline;
    }
}

.nav-links a:focus-visible,
.lang-btn:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.lang-btn {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    font-family: var(--font-family);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    min-height: 30px;
    min-width: 48px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.lang-btn:hover {
    background: var(--primary);
    color: white;
}

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

/* =========================================
   BUTTONS
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(122, 184, 0, 0.3);
}

.btn-primary:hover {
    background-color: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(122, 184, 0, 0.4);
}

.btn-secondary {
    background-color: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background-color: var(--bg-main);
    transform: translateY(-2px);
}

/* =========================================
   HERO SECTION
   ========================================= */
.hero {
    text-align: center;
    padding: 8rem 0 6rem;
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-main) 100%);
}

.hero p {
    max-width: 600px;
    margin: 0 auto 2.5rem;
    font-size: 1.25rem;
}

.mission-intro {
    font-weight: 700 !important;
    color: var(--primary) !important;
    font-size: 1.125rem !important;
    margin-bottom: 0.5rem !important;
}

.mission-text {
    max-width: 640px;
    margin: 0 auto 2.5rem;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

/* =========================================
   RECEIPTS HUNTER LEARN MORE PAGE
   ========================================= */
.learn-more-page .container-narrow {
    max-width: 720px;
}

.learn-more-back {
    text-align: left;
    margin-bottom: 1.5rem;
}

html[dir="rtl"] .learn-more-back {
    text-align: right;
}

.btn-back {
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.5rem 0;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-back:hover {
    color: var(--primary);
}

.learn-more-title {
    text-align: center;
    margin-bottom: 2rem;
}

.learn-more-body p {
    margin-bottom: 1.25rem;
    font-size: 1.125rem;
    line-height: 1.7;
}

.learn-more-actions {
    text-align: center;
    margin: 2.5rem 0 3rem;
}

.learn-more-actions .btn {
    display: inline-block;
}

.learn-more-aha {
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.learn-more-aha-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.learn-more-aha p {
    margin-bottom: 1.5rem;
    text-align: left;
}

html[dir="rtl"] .learn-more-aha p {
    text-align: right;
}

/* =========================================
   INVESTORAGENT BLUEPRINT PAGE
   ========================================= */
.investor-dashboard-page .container {
    max-width: 1100px;
}

.investor-hero {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.investor-kicker {
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 0.5rem !important;
}

.investor-hero h1 {
    margin-bottom: 1rem;
}

.investor-lead {
    max-width: 900px;
    margin-bottom: 0;
}

.investor-section {
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
}

.investor-section h2 {
    margin-bottom: 0.75rem;
    font-size: 1.7rem;
}

.investor-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.investor-card {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
}

.investor-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    color: var(--text-main);
}

.investor-card ul,
.investor-card ol {
    margin: 0;
    padding-left: 1.25rem;
}

.investor-card li {
    margin-bottom: 0.4rem;
}

.investor-note {
    margin-top: 1rem;
    margin-bottom: 0 !important;
    font-size: 0.95rem;
}

.investor-api-list code {
    font-size: 0.92rem;
}

.investor-final-cta p {
    margin-bottom: 0;
}

.investor-app-shell-preview h2 {
    margin-bottom: 1rem;
}

.investor-app-shell {
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 1rem;
}

.investor-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
}

.investor-sidebar-brand {
    color: var(--primary);
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.investor-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.investor-sidebar-nav a {
    text-decoration: none;
    color: var(--text-main);
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    font-weight: 600;
}

.investor-sidebar-nav a.is-active {
    background: var(--bg-main);
    color: var(--primary);
}

.investor-workspace {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.investor-topbar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.investor-topbar-item {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.investor-dashboard-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.investor-dashboard-header h3 {
    margin: 0 0 0.25rem 0;
    color: var(--primary);
}

.investor-dashboard-header p {
    margin: 0;
}

.investor-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.investor-header-actions .btn {
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
}

.investor-summary-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.75rem;
}

.investor-metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.investor-metric-card span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.investor-metric-card strong {
    color: var(--text-main);
    font-size: 1.05rem;
}

.investor-metric-card small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.investor-main-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
}

.investor-side-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.investor-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
}

.investor-panel h4 {
    margin: 0 0 0.45rem 0;
    color: var(--text-main);
    font-size: 1rem;
}

.investor-panel ul,
.investor-panel ol {
    margin: 0 0 0.75rem 0;
    padding-left: 1.15rem;
}

.investor-panel li {
    margin-bottom: 0.35rem;
}

.investor-panel-meta {
    margin: 0 0 0.6rem 0 !important;
    font-size: 0.88rem;
}

.investor-placeholder-bars {
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.investor-placeholder-bars div {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 0.5rem;
    align-items: center;
}

.investor-placeholder-bars span {
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 600;
}

.investor-placeholder-bars em {
    display: block;
    height: 8px;
    border-radius: 999px;
    background: var(--primary);
    opacity: 0.25;
}

.investor-inline-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.investor-inline-link:hover {
    text-decoration: underline;
}

.investor-inline-actions {
    display: flex;
    gap: 1rem;
}

.investor-secondary-row,
.investor-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.investor-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.investor-mini-table th,
.investor-mini-table td {
    border-bottom: 1px solid var(--border-color);
    padding: 0.45rem 0.25rem;
    text-align: left;
}

/* =========================================
   INVESTORAGENT LANDING + ONBOARDING FLOW
   ========================================= */
.investoragent-landing-page .container,
.investoragent-flow-page .container {
    max-width: 1100px;
}

.pm-performance-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.pm-control-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.pm-label {
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.92rem;
}

.pm-toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pm-toggle,
.pm-choice {
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
}

.pm-toggle:hover,
.pm-choice:hover {
    border-color: var(--primary);
}

.pm-toggle.is-active,
.pm-choice.is-active {
    border-color: var(--primary);
    color: var(--primary);
}

.pm-chart-card {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

#pm-chart {
    width: 100%;
    height: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.pm-chart-legend {
    margin-top: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.pm-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.pm-legend {
    width: 16px;
    height: 3px;
    border-radius: 999px;
    display: inline-block;
}

.pm-legend.portfolio {
    background: var(--primary);
}

.pm-legend.benchmark {
    background: var(--accent);
}

.pm-config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.pm-config-grid label {
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
}

.pm-config-result {
    margin-top: 0.85rem;
}

.pm-legal-box {
    margin-top: 1rem;
}

#pm-ready-btn:disabled,
#pm-subscribe-btn:disabled,
#pm-confirm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.pm-setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.pm-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.pm-payment-box {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pm-payment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.pm-password-rules {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0 !important;
}

.pm-password-rules li {
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    font-size: 0.92rem;
}

.pm-password-rules li.is-ok {
    color: #047857;
}

.pm-password-rules li.is-bad {
    color: #b91c1c;
}

.pm-processing-bar {
    margin-top: 0.75rem;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
    background-size: 200% 100%;
    animation: pm-loading 1.3s linear infinite;
}

@keyframes pm-loading {
    from { background-position: 0% 0%; }
    to { background-position: 200% 0%; }
}

.pm-success-box {
    text-align: center;
}

.invoice-legal-section {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.invoice-legal-title {
    font-size: 1.6rem;
    margin-bottom: 0.75rem;
}

.invoice-legal-subtitle {
    margin-bottom: 1.5rem;
}

.invoice-legal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.invoice-legal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.invoice-legal-card h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-main);
}

.invoice-legal-card p {
    margin: 0;
}

/* =========================================
   DASHBOARD (invoice_hunter/dashboard.html)
   ========================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

.dashboard-grid .card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    text-align: left;
}

html[dir="rtl"] .dashboard-grid .card {
    text-align: right;
}

.whatsapp-btn {
    background-color: #25D366;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    display: inline-block;
    font-weight: bold;
    margin-top: 15px;
}

.whatsapp-btn:hover {
    filter: brightness(1.05);
}

/* =========================================
   ONBOARDING & PLANS (invoice_hunter/onboarding.html, plans.html)
   ========================================= */
.pricing-page .container-narrow {
    max-width: 720px;
}

.pricing-page .container-narrow.pricing-with-split {
    max-width: 960px;
}

.pricing-title {
    text-align: center;
    margin-bottom: 1.5rem;
}

.pricing-country {
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.pricing-country-label {
    font-weight: 600;
    margin-right: 1rem;
}

.pricing-country-option {
    display: inline-flex;
    align-items: center;
    margin-right: 1.5rem;
    cursor: pointer;
}

.pricing-country-option input {
    margin-right: 0.5rem;
}

.pricing-common {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 0;
}

.pricing-part {
    margin-bottom: 2rem;
}

.pricing-part-heading {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.pricing-common .pricing-checkbox-label {
    margin-bottom: 0.75rem;
    align-items: center;
}

.pricing-common .pricing-checkbox-label span,
.pricing-common .pricing-checkbox-label .pricing-legal-link {
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.5;
}

.pricing-common .pricing-form-row {
    margin-top: 1rem;
    margin-bottom: 0;
}

.pricing-error {
    color: #b91c1c;
    font-size: 0.9rem;
    margin-top: 0.5rem !important;
}

.pricing-error.hidden {
    display: none !important;
}

.pricing-success {
    color: #047857;
}

.pricing-reset-wrap {
    margin-top: 0.25rem;
}

.pricing-reset-link {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: var(--link-color, #2563eb);
    text-decoration: underline;
    cursor: pointer;
}

.pricing-reset-link:hover {
    text-decoration: none;
}

.pricing-reset-link:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.pricing-table-wrap {
    overflow-x: auto;
    margin-bottom: 2.5rem;
}

.pricing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
}

.pricing-table th,
.pricing-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.pricing-table th {
    font-weight: 700;
    color: var(--primary);
}

.pricing-desc {
    font-size: 0.9rem;
    margin: 0.35rem 0 0 !important;
    color: var(--text-muted);
}

.pricing-amount {
    font-weight: 700;
    white-space: nowrap;
}

.pricing-flows {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* Vertical split: left = One-time try, right = Subscribe */
.pricing-flows-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.pricing-flows-split .pricing-flow {
    min-width: 0;
}

.pricing-post-scan-message {
    grid-column: 1 / -1;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.pricing-post-scan .pricing-flow-free {
    display: none;
}

.pricing-post-scan {
    grid-template-columns: 1fr;
}

html[dir="rtl"] .pricing-flows-split {
    direction: rtl;
}

html[dir="rtl"] .pricing-flows-split .pricing-flow-free {
    order: 2;
}

html[dir="rtl"] .pricing-flows-split .pricing-flow-paid {
    order: 1;
}

.pricing-flow-title {
    font-size: 1.35rem;
    margin-bottom: 1.25rem;
    color: var(--primary);
}

.pricing-step {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

/* Form groups (try-free, etc.) */
.form-group {
    margin-bottom: 1.25rem;
}
.form-group input[type="email"],
.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-family);
    box-sizing: border-box;
}
.form-group label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-main);
}
.form-group input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.hidden {
    display: none !important;
}

.pricing-step.hidden {
    display: none !important;
}

.pricing-step-label {
    font-weight: 600;
    margin-bottom: 0.75rem !important;
}

.pricing-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.pricing-input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.pricing-step-hint {
    font-size: 0.9rem;
    margin-top: 0.5rem !important;
}

.pricing-order-list {
    list-style: none;
    margin: 0 0 1rem !important;
    padding: 0;
}

.pricing-order-list li {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.pricing-order-addon label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.pricing-order-addon input {
    margin: 0;
}

.pricing-total {
    margin: 1rem 0 !important;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 1.1rem;
}

.pricing-agreement-text {
    font-size: 0.95rem;
    margin-bottom: 1rem !important;
}

.pricing-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    margin-bottom: 1rem;
}

.pricing-checkbox-label input {
    margin-top: 0.25rem;
}

.pricing-common .pricing-checkbox-label input {
    margin-top: 0;
}

/* Modal */
.pricing-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.pricing-modal-overlay.hidden {
    display: none !important;
}

.pricing-modal {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
}

.pricing-modal h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.pricing-modal p {
    margin-bottom: 1.5rem !important;
    font-size: 0.95rem;
}

.pricing-modal .btn {
    width: 100%;
}

.pricing-legal-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
    vertical-align: baseline;
}

.pricing-legal-link:hover {
    color: var(--primary-dark);
}

.legal-popup-overlay .legal-popup {
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.legal-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.legal-popup-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.legal-popup-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 0.25rem;
}

.legal-popup-close:hover {
    color: var(--text-main);
}

.legal-popup-scroll {
    max-height: 50vh;
    flex: 1 1 auto;
    margin-bottom: 1rem;
}

.legal-popup-btn-close {
    flex-shrink: 0;
}

html[dir="rtl"] .pricing-table th,
html[dir="rtl"] .pricing-table td {
    text-align: right;
}

/* =========================================
   LEGAL PAGES (Terms of Service, Privacy Policy)
   ========================================= */
.legal-page .container-narrow {
    max-width: 720px;
}

.legal-page-title {
    margin-bottom: 1.5rem;
}

.legal-page-header {
    margin-bottom: 1rem;
}

.legal-page-context {
    margin-bottom: 1rem;
}

.legal-page-links {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.legal-page-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--primary);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-weight: 600;
}

.legal-page-link:hover {
    border-color: var(--primary);
}

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

.legal-doc-scroll {
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    padding: 0;
}

.legal-doc-content {
    padding: 2rem;
}

.legal-doc-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.legal-doc-content h2:first-of-type {
    margin-top: 0;
}

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

.legal-doc-content .effective-date {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    display: block;
}

.legal-doc-content ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.legal-doc-content li {
    margin-bottom: 0.5rem;
}

.legal-doc-content a {
    color: var(--primary);
    text-decoration: none;
}

.legal-doc-content a:hover {
    text-decoration: underline;
}

/* Scan page (after connect callback) */
.scan-success-message {
    margin-bottom: 1.5rem;
    color: var(--text-main);
}
.scan-picker-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
}
.scan-picker-wrap label {
    font-weight: 600;
    color: var(--text-main);
}
.scan-picker-wrap select {
    min-width: 6rem;
}
html[dir="rtl"] .scan-picker-wrap {
    flex-direction: row-reverse;
}

.scan-what-expect-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.scan-expect-list {
    margin: 0 0 1rem 0;
    padding-left: 1.5rem;
}

html[dir="rtl"] .scan-expect-list {
    padding-left: 0;
    padding-right: 1.5rem;
}

.scan-expect-list li {
    margin-bottom: 0.5rem;
}

.scan-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.scan-result-actions .btn-secondary {
    background: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border-color, #ccc);
}

/* Legal popup: same typography as full legal page (override .pricing-modal p) */
.legal-popup-overlay .legal-popup .legal-doc-content p {
    font-size: 1.125rem;
    margin-bottom: 1rem !important;
}

/* RTL: legal doc list padding */
html[dir="rtl"] .legal-doc-content ul {
    padding-left: 0;
    padding-right: 1.5rem;
}

/* =========================================
   SECTION TITLES (PRODUCTS, ETC.)
   ========================================= */
.section-title {
    text-align: center;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    text-align: center;
    margin-bottom: 3rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.product-card .btn {
    margin-top: 1rem;
    width: 100%;
}

.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* =========================================
   HOW IT WORKS (3-STEP GRID)
   ========================================= */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 4rem;
}

.step-card {
    background: var(--bg-card);
    padding: 3rem 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease;
}

.step-card:hover {
    transform: translateY(-5px);
}

.step-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.step-card h3 {
    font-size: 1.5rem;
    color: var(--text-main);
}

/* =========================================
   RECEIPTS HUNTER EXPLICIT FLOW PAGES
   ========================================= */
.rh-flow-shell {
    display: grid;
    gap: 1.5rem;
}

.rh-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
}

.rh-card h2,
.rh-card h3 {
    margin-bottom: 0.75rem;
}

.rh-card p:last-child {
    margin-bottom: 0;
}

.rh-choice-grid,
.rh-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.rh-choice-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
}

html[dir="rtl"] .rh-choice-card {
    text-align: right;
}

.rh-choice-card .btn {
    align-self: flex-start;
}

html[dir="rtl"] .rh-choice-card .btn {
    align-self: flex-end;
}

.rh-inline-note {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 12px;
    color: var(--text-main);
    padding: 1rem 1.25rem;
}

.rh-inline-note strong {
    color: var(--primary-dark);
}

.rh-inline-note.is-warning {
    background: rgba(245, 158, 11, 0.10);
    border-color: rgba(245, 158, 11, 0.25);
}

.rh-inline-note.is-error {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.18);
}

.rh-progress-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    display: grid;
    gap: 0.85rem;
}

.rh-progress-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.rh-progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--border-color);
    flex-shrink: 0;
}

.rh-progress-item.is-active .rh-progress-dot {
    background: var(--primary);
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.12);
}

.rh-progress-item.is-complete .rh-progress-dot {
    background: #22c55e;
}

.rh-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 1.25rem;
}

.rh-actions .btn {
    min-width: 180px;
}

@media (max-width: 1024px) {
    h1 { font-size: 2.75rem; }
    h2 { font-size: 2rem; }

    .container,
    .nav-container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .nav-container {
        min-height: 72px;
    }

    .nav-brand-and-links {
        gap: 20px;
    }

    .logo img {
        height: 76px;
    }

    .nav-links {
        gap: 14px;
        font-size: 0.95rem;
    }

    .hero {
        padding: 6rem 0 4.5rem;
    }

    .hero p {
        font-size: 1.15rem;
    }

    .steps-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
    }

    .step-card {
        padding: 2.25rem 1.5rem;
    }

    .invoice-legal-grid,
    .pricing-flows-split,
    .investor-main-row,
    .investor-secondary-row,
    .investor-bottom-row {
        grid-template-columns: 1fr;
    }

    .investor-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .investor-dashboard-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .pm-config-grid {
        grid-template-columns: 1fr;
    }

    .pm-toggle-row {
        gap: 0.45rem;
    }

    .legal-doc-scroll {
        max-height: 65vh;
    }
}

.rh-payment-placeholder,
.rh-schedule-box {
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.02);
}

.rh-checklist {
    margin: 1rem 0 0;
    padding-left: 1.25rem;
}

html[dir="rtl"] .rh-checklist {
    padding-left: 0;
    padding-right: 1.25rem;
}

.rh-checklist li {
    margin-bottom: 0.5rem;
}

.rh-meta-list {
    display: grid;
    gap: 0.9rem;
}

.rh-meta-item {
    padding: 1rem 1.1rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.03);
    border: 1px solid var(--border-color);
}

.rh-meta-item strong {
    display: block;
    margin-bottom: 0.35rem;
}

/* =========================================
   FOOTER
   ========================================= */
footer {
    background-color: var(--primary-dark);
    color: white;
    padding: 3rem 0;
    text-align: center;
    margin-top: auto;
}

footer p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin: 0;
}

/* =========================================
   RTL SUPPORT (HEBREW)
   EN (LTR):  Home, Products, Terms, Privacy, Contact  (left to right)
   HE (RTL):  Nav block on right, lang button on left.
              Contact stays the last nav item, so in RTL it appears on the far left.
   ========================================= */
html[dir="rtl"] .nav-container {
    direction: rtl;
}

html[dir="rtl"] .nav-brand-and-links {
    direction: rtl;
}

/* RTL: keep the last DOM link on the far left and Home on the far right */
html[dir="rtl"] .nav-links {
    flex-direction: row;
    direction: ltr;
}
html[dir="rtl"] .nav-links a:nth-child(1) { order: 5; }  /* Home → rightmost */
html[dir="rtl"] .nav-links a:nth-child(2) { order: 4; }  /* Products */
html[dir="rtl"] .nav-links a:nth-child(3) { order: 3; }  /* Terms */
html[dir="rtl"] .nav-links a:nth-child(4) { order: 2; }  /* Privacy */
html[dir="rtl"] .nav-links a:nth-child(5) { order: 1; }  /* Contact → leftmost */

html[dir="rtl"] .hero-buttons {
    flex-direction: row-reverse;
}

/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 768px) {
    /* Typography */
    h1 { font-size: 2rem; margin-bottom: 1rem; }
    h2 { font-size: 1.75rem; margin-bottom: 0.75rem; }
    p { font-size: 1rem; margin-bottom: 1.25rem; }

    /* Layout & spacing */
    .container { padding: 0 1rem; }
    .section { padding: 3rem 0; }

    /* Nav: compact mobile layout, keep it to two rows max */
    .nav-container {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "brand lang"
            "links links";
        align-items: center;
        height: auto;
        min-height: 0;
        padding: 0.5rem 1rem 0.65rem;
        gap: 0.5rem 0.75rem;
    }
    .nav-brand-and-links {
        display: contents;
    }
    .logo {
        grid-area: brand;
        justify-self: start;
    }
    .logo img { height: 42px; }
    .nav-links {
        grid-area: links;
        flex-wrap: nowrap;
        gap: 0.75rem;
        width: 100%;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        font-size: 0.95rem;
        margin-top: 0.15rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-color);
    }
    .nav-links::-webkit-scrollbar {
        display: none;
    }
    .nav-links a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 0.25rem 0.2rem;
        -webkit-tap-highlight-color: transparent;
    }
    .lang-btn {
        grid-area: lang;
        justify-self: end;
        min-height: 40px;
        min-width: 40px;
        padding: 0.35rem 0.7rem;
        font-size: 0.75rem;
    }
    html[dir="rtl"] .logo {
        justify-self: end;
    }
    html[dir="rtl"] .nav-links {
        justify-content: flex-end;
    }
    html[dir="rtl"] .lang-btn {
        justify-self: start;
    }

    /* Hero (home page) */
    .hero { padding: 4rem 0 3rem; }
    .hero p { font-size: 1.1rem; margin-bottom: 1.5rem; }
    .mission-text { margin-bottom: 1.5rem; }
    .hero-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    .hero-buttons .btn { width: 100%; max-width: 280px; }
    html[dir="rtl"] .hero-buttons { flex-direction: column; }

    /* Products grid */
    .products-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .section-subtitle { margin-bottom: 2rem; }

    /* Steps grid (3-col → 1-col) */
    .steps-grid { grid-template-columns: 1fr; gap: 1.5rem; margin-top: 2rem; }
    .step-card { padding: 2rem 1.25rem; }
    .rh-choice-grid,
    .rh-summary-grid { grid-template-columns: 1fr; }
    .rh-card { padding: 1.25rem; }
    .rh-choice-card .btn,
    .rh-actions .btn { width: 100%; }

    /* Invoices Hunter learn-more page */
    .learn-more-page .section { padding: 2rem 0 3rem; }
    .learn-more-title { font-size: 1.75rem; margin-bottom: 1.5rem; }
    .learn-more-body p { font-size: 1rem; margin-bottom: 1rem; }
    .learn-more-actions { margin: 1.5rem 0 2rem; }
    .learn-more-actions .btn { width: 100%; max-width: 280px; }
    .learn-more-aha {
        padding-top: 1.5rem;
        margin-top: 1.5rem;
    }
    .learn-more-aha-title { font-size: 1.25rem; }
    .learn-more-aha .learn-more-actions { margin: 1rem 0 0; }
    .invoice-legal-section {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }
    .invoice-legal-title { font-size: 1.3rem; }
    .invoice-legal-grid { grid-template-columns: 1fr; }
    .investor-hero,
    .investor-section {
        padding: 1.1rem;
    }
    .investor-hero h1 {
        font-size: 1.6rem;
    }
    .investor-grid-two {
        grid-template-columns: 1fr;
    }
    .investor-app-shell {
        grid-template-columns: 1fr;
    }
    .investor-summary-grid {
        grid-template-columns: 1fr 1fr;
    }
    .investor-main-row,
    .investor-secondary-row,
    .investor-bottom-row {
        grid-template-columns: 1fr;
    }
    .investor-dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .pm-config-grid,
    .pm-setup-grid,
    .pm-payment-grid {
        grid-template-columns: 1fr;
    }
    .pm-choice-grid {
        grid-template-columns: 1fr;
    }
    .pm-chart-legend {
        gap: 0.5rem 1rem;
    }

    /* Buttons: comfortable touch targets, full width where it helps */
    .btn { padding: 0.875rem 1.5rem; font-size: 1rem; }
    .product-card .btn { width: 100%; }

    /* Dashboard (invoice_hunter) 2-col grid → 1 col */
    .dashboard-grid { grid-template-columns: 1fr; }

    /* Pricing page */
    .pricing-flows-split {
        grid-template-columns: 1fr;
    }
    .pricing-country {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    .pricing-form-row {
        flex-direction: column;
        align-items: stretch;
    }
    .pricing-input { min-width: 0; }
    .pricing-step { padding: 1.25rem; }
    .pricing-order-list li {
        flex-direction: column;
        gap: 0.35rem;
    }
    .pricing-order-addon label {
        align-items: flex-start;
    }
    .pricing-table th,
    .pricing-table td {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
    .pricing-table-wrap {
        -webkit-overflow-scrolling: touch;
        margin-left: -0.25rem;
        margin-right: -0.25rem;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    .pricing-modal {
        padding: 1.5rem;
        max-width: calc(100vw - 2rem);
        min-width: 0;
    }
    .legal-popup-overlay .legal-popup {
        max-height: 85vh;
        max-width: calc(100vw - 2rem);
        min-width: 0;
    }
    .legal-popup-scroll { max-height: 50vh; }
    .legal-popup-overlay .legal-popup .legal-doc-content p {
        font-size: 1rem;
    }

    /* Legal pages (full) */
    .legal-page-title {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    .legal-doc-content p,
    .legal-doc-content a,
    .step-card a {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .legal-page-links {
        display: flex;
        width: 100%;
    }
    .legal-doc-scroll { max-height: 60vh; }
    .legal-doc-content { padding: 1.25rem; }

    /* Try-free / forms */
    .form-group input[type="email"],
    .form-group input[type="text"] {
        min-height: 48px;
    }
    main .form-group + .btn,
    main form .btn[type="submit"] {
        width: 100%;
        min-height: 48px;
    }

    /* Back button & legal links: touch-friendly */
    .learn-more-back .btn-back,
    .btn-back {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }
    .pricing-legal-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: 0.25rem 0;
        -webkit-tap-highlight-color: transparent;
    }
    .pricing-checkbox-label {
        min-height: 44px;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
    }
    .scan-picker-wrap {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .scan-picker-wrap select {
        min-width: 0;
        width: 100%;
    }
    .rh-progress-item {
        align-items: flex-start;
    }
    .rh-progress-item span:last-child {
        min-width: 0;
    }
}

/* Very small phones */
@media (max-width: 380px) {
    .nav-container { padding: 0.45rem 0.75rem 0.6rem; }
    .logo img { height: 36px; }
    .nav-links { gap: 0.65rem; font-size: 0.875rem; }
    h1 { font-size: 1.75rem; }
    .container { padding: 0 0.75rem; }
    .pricing-modal-overlay { padding: 0.5rem; }
    .legal-popup-overlay .legal-popup { max-width: calc(100vw - 1rem); }
}

@media (max-width: 480px) {
    .investor-summary-grid,
    .pm-setup-grid {
        grid-template-columns: 1fr;
    }

    .pm-toggle,
    .pm-choice {
        width: 100%;
        justify-content: center;
    }
}
