/* CSS Custom Properties (Variables) for Dynamic Theming */
:root {
    /* 8px Modular Spacing Scale */
    --spacing-1: 8px;
    --spacing-2: 16px;
    --spacing-3: 24px;
    --spacing-4: 32px;
    --spacing-5: 40px;
    --spacing-6: 48px;
    --spacing-7: 56px;
    --spacing-8: 64px;
    --spacing-9: 72px;
    --spacing-10: 80px;
    --spacing-11: 88px;
    --spacing-12: 96px;

    /* Structural Variables */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;

    /* Primary colors */
    --primary-color: #5469d4;
    --primary-hover-color: #4358c4;
    --primary-active-color: #3d4eae;

    /* Text colors (WCAG AA Compliant) */
    --text-primary-color: #1e293b;
    --text-secondary-color: #475569;
    --text-light-color: #64748b;
    --link-color: #4f46e5;

    /* Background colors - Adjusted for NAMS teal-variance and reduced harshness */
    --background-color: #f0f7f9;
    --surface-color: #ffffff;
    --surface-alt-color: #e1edf2;

    /* Border colors - Softened teal-gray for better definition without harshness */
    --border-color: #d1e1e5;

    /* Status colors (WCAG AA Compliant) */
    --success-color: #15803d;
    --error-color: #dc2626;
    --warning-color: #a16207;
    --info-color: #0369a1;

    /* Header/Footer */
    --header-background-color: #ffffff;
    --footer-text-color: #64748b;

    /* Derived colors (computed from status colors) */
    --success-bg-color: #dcfce7;
    --success-text-color: #166534;
    --success-border-color: #bbf7d0;
    --error-bg-color: #fee2e2;
    --error-text-color: #991b1b;
    --error-border-color: #fecaca;
    --warning-bg-color: #fef9c3;
    --warning-text-color: #854d0e;
    --info-bg-color: #e0f2fe;
    --info-text-color: #075985;
    --neutral-bg-color: #f1f5f9;
    --neutral-text-color: #334155;

    /* Interactive / Polish */
    --scrollbar-thumb-color: rgba(199, 200, 255, 0.7);
    --scrollbar-thumb-hover: rgba(199, 200, 255, 0.9);
    --focus-ring-color: rgba(84, 105, 212, 0.4);
    --focus-shadow-color: rgba(84, 105, 212, 0.1);

    /* Sidebar specific */
    --sidebar-width: 260px;
    --sidebar-bg: #0f172a; /* Deep space blue */
    --sidebar-text: #f8fafc;
    --sidebar-text-muted: #94a3b8;
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active-bg: rgba(255, 255, 255, 0.12);
    --sidebar-active-border: #d1b75c; /* Gold filigree color */
}

/* Dark Mode Overrides */
body.dark-mode {
    --text-primary-color: #e4e4e7;
    --text-secondary-color: #a1a1aa;
    --text-light-color: #71717a;
    --link-color: #93a3e8;
    --background-color: #18181b;
    --surface-color: #27272a;
    --surface-alt-color: #3f3f46;
    --border-color: #52525b;
    --header-background-color: #27272a;
    --footer-text-color: #a1a1aa;

    /* Dark mode derived colors */
    --success-bg-color: #14532d;
    --success-text-color: #86efac;
    --success-border-color: #166534;
    --error-bg-color: #7f1d1d;
    --error-text-color: #fca5a5;
    --error-border-color: #991b1b;
    --warning-bg-color: #713f12;
    --warning-text-color: #fde047;
    --info-bg-color: #1e3a5f;
    --info-text-color: #7dd3fc;
    --neutral-bg-color: #3f3f46;
    --neutral-text-color: #d4d4d8;

    /* Interactive / Polish for Dark Mode */
    --scrollbar-thumb-color: rgba(255, 255, 255, 0.2);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.3);
    --focus-ring-color: rgba(147, 163, 232, 0.5);
    --focus-shadow-color: rgba(84, 105, 212, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary-color);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    overscroll-behavior: none;
}

.app-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.app-main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    min-width: 0;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
    padding: var(--spacing-3);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

main {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 12px rgba(255, 255, 255, 0.1);
    padding: var(--spacing-4);
    width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    display: flex;
    flex-direction: column;
    color: var(--text-primary-color);
}

/* Surface contrast — nested sections visually distinct from parent */
/* Elements using surface-alt-color get a subtle inset shadow for depth */
[style*="surface-alt-color"],
.settings-section,
.processor-subcard,
.rollup-metric,
.section-header,
.loa-template-slot {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Reusable white child card — sits on the dark main surface */
.content-card {
    background: var(--surface-alt-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-4) var(--spacing-3);
    color: var(--text-primary-color);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.content-card h1,
.content-card h2,
.content-card h3,
.content-card label {
    color: var(--text-primary-color);
}

.content-card a {
    color: var(--text-secondary-color);
}

.content-card input,
.content-card select,
.content-card textarea {
    background: var(--surface-color);
    color: var(--text-primary-color);
}

/* Footer */
footer {
    text-align: center;
    padding: var(--spacing-1) 0;
    color: var(--footer-text-color);
    font-size: 11px;
    flex-shrink: 0;
    line-height: 1.4;
}

footer nav {
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Organization Header Section */
.org-header-section {
    text-align: center;
    margin-bottom: var(--spacing-4);
    padding-bottom: var(--spacing-3);
    border-bottom: 1px solid var(--border-color);
}

.org-logo-large {
    max-width: 100%;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin-bottom: var(--spacing-2);
    border-radius: var(--border-radius-md);
}

.org-name-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary-color);
    margin: 0;
}

/* Payment Form */
.payment-container {
    max-width: 850px;
    margin: var(--spacing-4) auto var(--spacing-8);
    padding: 0 var(--spacing-3);
    box-sizing: border-box;
}

.payment-form-footer {
    margin-top: var(--spacing-4);
    padding: var(--spacing-4);
    background: var(--surface-alt-color);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
}

#paymentCardContainer {
    min-height: var(--spacing-6);
    padding: 12px var(--spacing-2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background-color: var(--surface-color);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    margin-top: var(--spacing-1);
}

#paymentCardContainer:focus-within {
    border-color: var(--primary-color, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1), inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.payment-container h2 {
    font-size: 1.75rem;
    margin-bottom: 2rem;
    text-align: left;
    color: var(--text-primary-color);
    font-weight: 700;
}

.form-section {
    margin-bottom: var(--spacing-4);
    padding-bottom: var(--spacing-3);
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: var(--spacing-2);
    padding-bottom: 0;
}

.form-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-2);
}

.form-group {
    margin-bottom: var(--spacing-2);
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: var(--spacing-1);
    color: var(--text-primary-color);
}

.form-group input,
.form-group select {
    width: 100%;
    max-width: 100%;
    padding: 10px var(--spacing-2);
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background-color: var(--surface-color);
    color: var(--text-primary-color);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-shadow-color);
}

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

/* Two column layout */
.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    max-width: 100%;
}

.form-group.half {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

/* Stripe Card Element */
#card-element {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--surface-color);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#card-element.StripeElement--focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-shadow-color);
}

#card-element.StripeElement--invalid {
    border-color: var(--error-color);
}

/* Error Message */
.error-message {
    color: var(--error-color);
    font-size: 14px;
    margin-top: 8px;
    min-height: 20px;
}

/* Submit Button — neutralized green */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: var(--spacing-2) var(--spacing-4);
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF;
    background-color: var(--success-color);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    text-decoration: none;
}

.btn-primary:hover {
    background-color: var(--success-text-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Secondary Button — neutralized blue */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-1) var(--spacing-3);
    font-size: 14px;
    font-weight: 500;
    color: #FFFFFF;
    background-color: var(--info-color);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    text-decoration: none;
}

.btn-secondary:hover {
    background-color: var(--info-text-color);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* =========================================================================
   Semantic Button Colors (standardized across all templates)
   ========================================================================= */

/* Global text shadow and soft white for button text */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-edit,
.btn-action,
.btn-success,
.btn-payment {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    color: #ffffff;
}

/* Serious / Destructive actions (remove, revoke, cancel, delete) — neutralized red */
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-1) var(--spacing-3);
    font-size: 14px;
    font-weight: 600;
    color: #FFFFFF;
    background-color: var(--error-color);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn-danger:hover { background-color: var(--error-text-color); transform: translateY(-1px); }
.btn-danger:active { transform: translateY(0); }
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Edit actions (edit details, resend welcome, reset password) — neutralized yellow */
.btn-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-1) var(--spacing-3);
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background-color: var(--warning-color);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn-edit:hover { background-color: var(--warning-text-color); transform: translateY(-1px); }
.btn-edit:active { transform: translateY(0); }
.btn-edit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Non-primary actions (email, Google Meet, external links) — neutralized blue */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-1) var(--spacing-3);
    font-size: 14px;
    font-weight: 600;
    color: #FFFFFF;
    background-color: var(--info-color);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn-action:hover { background-color: var(--info-text-color); transform: translateY(-1px); }
.btn-action:active { transform: translateY(0); }
.btn-action:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Positive actions (submit, agree, approve) — neutralized green */
.btn-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-1) var(--spacing-3);
    font-size: 14px;
    font-weight: 600;
    color: #FFFFFF;
    background-color: var(--success-color);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn-success:hover { background-color: var(--success-text-color); transform: translateY(-1px); }
.btn-success:active { transform: translateY(0); }
.btn-success:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Payment buttons — neutralized red with white text */
.btn-payment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2) var(--spacing-4);
    font-size: 16px;
    font-weight: 700;
    color: #FFFFFF;
    background-color: var(--error-color);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn-payment:hover { background-color: var(--error-text-color); transform: translateY(-1px); }
.btn-payment:active { transform: translateY(0); }
.btn-payment:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--surface-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Message */
.message {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

.message.success {
    background-color: var(--success-bg-color);
    color: var(--success-text-color);
    border: 1px solid var(--success-border-color);
}

.message.error {
    background-color: var(--error-bg-color);
    color: var(--error-text-color);
    border: 1px solid var(--error-border-color);
}

/* Hidden class */
.hidden {
    display: none;
}

/* Result Pages */
.result-container {
    text-align: center;
    max-width: 800px;
    margin: auto;
    padding: var(--spacing-3);
    box-sizing: border-box;
}

.result-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto var(--spacing-3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.result-container.success .result-icon {
    color: var(--success-color);
}

.result-container.failure .result-icon {
    color: var(--error-color);
}

.result-container h2 {
    font-size: 28px;
    margin-bottom: var(--spacing-2);
}

.result-container.success h2 {
    color: var(--success-color);
}

.result-container.failure h2 {
    color: var(--error-color);
}

.result-message {
    font-size: 16px;
    color: var(--text-light-color);
    margin-bottom: var(--spacing-3);
}

/* Payment Details */
.payment-details {
    background: var(--surface-alt-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-3);
    margin: var(--spacing-3) 0;
    text-align: left;
}

.payment-details h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: var(--spacing-2);
    color: var(--text-light-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.payment-details dl {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: var(--spacing-1) var(--spacing-2);
    margin: 0;
}

.payment-details dt {
    font-weight: 500;
    color: var(--text-light-color);
    font-size: 0.9rem;
}

.payment-details dd {
    margin: 0;
    font-weight: 600;
    color: var(--text-primary-color);
    font-size: 0.95rem;
}

.payment-details dt {
    font-weight: 500;
    color: var(--text-secondary-color);
}

.payment-details dd {
    color: var(--text-primary-color);
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: var(--spacing-1) var(--spacing-2);
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    text-transform: uppercase;
}

.status-pending {
    background-color: var(--warning-bg-color);
    color: var(--warning-text-color);
}

.status-processing {
    background-color: var(--info-bg-color);
    color: var(--info-text-color);
}

.status-completed {
    background-color: var(--success-bg-color);
    color: var(--success-text-color);
}

.status-failed {
    background-color: var(--error-bg-color);
    color: var(--error-text-color);
}

.status-refunded {
    background-color: var(--neutral-bg-color);
    color: var(--neutral-text-color);
}

.status-cancelled {
    background-color: var(--neutral-bg-color);
    color: var(--neutral-text-color);
}

.status-admin {
    background-color: rgba(84, 105, 212, 0.15);
    color: var(--primary-color);
}

/* Confirmation Page Styles */
.confirmation-header {
    text-align: center;
    margin-bottom: var(--spacing-3);
}

.confirmation-header h3 {
    font-size: 22px;
    color: var(--text-primary-color);
    margin-bottom: var(--spacing-1);
}

.confirmation-note {
    font-size: 14px;
    color: var(--text-secondary-color);
    margin-bottom: var(--spacing-3);
}

.confirm-buttons {
    display: flex;
    gap: var(--spacing-2);
    margin-top: var(--spacing-3);
}

.confirm-buttons .btn-edit {
    flex: 1;
}

.confirm-buttons .btn-payment {
    flex: 2;
}

/* Payment Flow Button Styles — fixed semantic colors */
#review-button {
    background-color: var(--success-color);
    color: #ffffff;
    border: 2px solid var(--success-color);
}

#review-button:hover {
    background-color: var(--success-text-color);
    border-color: var(--success-text-color);
}

#review-button:active {
    background-color: var(--success-text-color);
    border-color: var(--success-text-color);
}

#submit-button {
    background-color: var(--error-color);
    color: #ffffff;
    border: 2px solid var(--error-color);
}

#submit-button:hover {
    background-color: var(--error-text-color);
    border-color: var(--error-text-color);
    color: #ffffff;
}

#submit-button:active {
    background-color: var(--error-text-color);
    border-color: var(--error-text-color);
}

#edit-button {
    background-color: var(--warning-color);
    color: #ffffff;
    border: 2px solid var(--warning-color);
}

#edit-button:hover {
    background-color: var(--warning-text-color);
    color: #ffffff;
}

#edit-button:active {
    background-color: var(--warning-text-color);
    border-color: var(--warning-text-color);
}

.error-details {
    background: var(--error-bg-color);
    border: 1px solid var(--error-border-color);
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    text-align: left;
}

.help-text {
    font-size: 14px;
    color: var(--text-light-color);
    margin-bottom: 25px;
}

/* Color Scheme Editor (Owner Only) */
.color-scheme-editor {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-3);
    width: 100%;
}

.color-scheme-editor h2 {
    margin-bottom: var(--spacing-4);
    color: var(--text-primary-color);
}

.color-group {
    margin-bottom: var(--spacing-4);
    padding: var(--spacing-3);
    background: var(--surface-alt-color);
    border-radius: var(--border-radius-md);
}

.color-group h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-2);
}

.color-input-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: var(--spacing-2);
    flex-wrap: wrap;
    max-width: 100%;
}

.color-input-group label {
    flex: 1;
    min-width: 150px;
    font-size: 14px;
    color: var(--text-primary-color);
    overflow-wrap: break-word;
}

.color-input-group input[type="color"] {
    width: 50px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0;
}

.color-input-group input[type="text"] {
    width: 100px;
    max-width: 100%;
    padding: var(--spacing-1);
    font-size: 14px;
    font-family: monospace;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background-color: var(--surface-color);
    color: var(--text-primary-color);
    text-transform: uppercase;
    box-sizing: border-box;
}

.color-preview {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

/* Preview Section */
.preview-section {
    margin-top: var(--spacing-5);
    padding: var(--spacing-3);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-md);
}

.preview-section h3 {
    margin-bottom: 20px;
    color: var(--text-primary-color);
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    main {
        padding: 20px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group.half {
        flex: none;
        width: 100%;
        max-width: 100%;
    }

    .payment-details dl {
        grid-template-columns: 1fr;
    }

    .payment-details dt {
        margin-top: 10px;
    }

    .confirm-buttons {
        flex-direction: column;
    }

    .confirm-buttons .btn-edit,
    .confirm-buttons .btn-payment {
        flex: none;
        width: 100%;
    }

    .org-logo-large {
        max-width: 80px;
    }

    .org-name-title {
        font-size: 20px;
    }

    .color-input-group {
        flex-wrap: wrap;
    }

    .color-input-group label {
        flex-basis: 100%;
        margin-bottom: 8px;
        min-width: 100%;
    }

    /* Ensure tables scroll on small screens */
    .table-container {
        margin-left: -15px;
        margin-right: -15px;
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Stack navigation items vertically on very small screens if needed */
    header nav {
        word-break: break-word;
    }

    footer nav {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    footer nav span {
        display: none;
    }

    /* Reduce font sizes slightly on small screens to prevent overflow */
    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }
}

/* Additional responsive breakpoint for tablets */
@media (max-width: 768px) {
    .form-row {
        flex-wrap: wrap;
    }

    .form-group.half {
        min-width: calc(50% - 8px);
    }

    .color-input-group {
        flex-wrap: wrap;
    }
}

/* Ensure very small screens don't have overflow */
@media (max-width: 320px) {
    .container {
        padding: 10px;
    }

    main {
        padding: 15px;
    }

    .form-group.half {
        min-width: 100%;
    }

    .color-input-group label {
        min-width: 100%;
    }

    .color-input-group input[type="text"] {
        width: 80px;
    }
}

/* Toggle Switch */
.toggle-input-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toggle-input-group > label:first-child {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary-color);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.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(--border-color);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--surface-color);
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px var(--focus-shadow-color);
}

.toggle-label {
    font-size: 14px;
    color: var(--text-secondary-color);
    min-width: 70px;
}

/* Table Responsiveness - Prevent horizontal overflow */
table {
    width: 100%;
    max-width: 100%;
    table-layout: auto;
}

.table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table th,
table td {
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-width: 100%;
}

/* Utility classes for overflow prevention */
.overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.max-w-full {
    max-width: 100%;
}

.word-break {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Ensure pre and code elements don't cause overflow */
pre, code {
    max-width: 100%;
    overflow-x: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Ensure iframes and embedded content are responsive */
iframe, embed, object, video {
    max-width: 100%;
    height: auto;
}

/* Additional overflow prevention for specific elements */
.payment-container,
.result-container,
.color-scheme-editor {
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Ensure article content in policy pages doesn't overflow */
article {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

article > div {
    max-width: 100%;
}

article h1, article h2, article h3 {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

article ul, article ol {
    max-width: 100%;
    padding-left: 20px;
}

/* Org grid responsiveness improvements */
.org-grid {
    max-width: 100%;
}

/* Ensure buttons don't cause overflow */
button, [class*="btn-"] {
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Additional form element safeguards */
input, select, textarea {
    max-width: 100%;
    box-sizing: border-box;
    color: var(--text-primary-color);
    background-color: var(--surface-color);
}

textarea {
    width: 100%;
    resize: vertical;
}

/* ===== Form Validation Styles ===== */
.field-error {
    border-color: var(--error-color) !important;
    background-color: var(--error-bg-color);
}

.field-error:focus {
    border-color: var(--error-color) !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

.form-group .error-message {
    color: var(--error-color);
    font-size: 13px;
    margin-top: 6px;
    display: none;
    font-weight: 500;
}

.form-group .error-message:not(:empty) {
    display: block;
}

/* Success state for validated fields */
.field-success {
    border-color: var(--success-color) !important;
}

.field-success:focus {
    border-color: var(--success-color) !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1) !important;
}

/* Password strength indicator */
.password-strength-indicator {
    margin-top: 8px;
}

.strength-bar {
    height: 4px;
    background-color: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.strength-fill {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    width: 0;
}

.strength-bar.strength-weak .strength-fill {
    width: 33%;
    background-color: var(--error-color);
}

.strength-bar.strength-medium .strength-fill {
    width: 66%;
    background-color: var(--warning-color);
}

.strength-bar.strength-strong .strength-fill {
    width: 100%;
    background-color: var(--success-color);
}

.strength-text {
    font-size: 13px;
    color: var(--text-secondary-color);
}

.strength-text strong {
    color: var(--text-primary-color);
    text-transform: capitalize;
}

/* ===== Skip to Content Link (Accessibility) ===== */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 4px 0;
    font-weight: 500;
}

.skip-to-content:focus {
    top: 0;
    outline: 3px solid var(--primary-hover-color);
    outline-offset: 2px;
}

/* ===== Screen Reader Only Content ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ===== Focus Visible Enhancement ===== */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Remove default focus for mouse users, keep for keyboard */
*:focus:not(:focus-visible) {
    outline: none;
}

/* ===== Hamburger Menu for Mobile ===== */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: 2px solid var(--border-color);
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: var(--surface-alt-color);
    border-color: var(--text-secondary-color);
}

.mobile-menu-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 24px;
}

.hamburger-icon span {
    display: block;
    height: 2px;
    background-color: var(--text-primary-color);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:first-child {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:last-child {
    transform: rotate(-45deg) translate(6px, -6px);
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .sticky-header .nav-links,
    .sticky-header .nav-bottom-actions {
        display: none;
    }

    .sticky-header.menu-open .nav-links,
    .sticky-header.menu-open .nav-bottom-actions {
        display: flex;
    }

    .sticky-header.menu-open {
        max-width: 90%;
    }

    .header-main {
        position: relative;
    }

    .mobile-menu-toggle {
        position: absolute;
        top: 0;
        right: 0;
    }
}

/* ========================================
   Icon Utility Classes
   ======================================== */

/* Icon sizes - use with img tags */
.icon-xs {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

.icon-sm {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.icon-md {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.icon-lg {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.icon-xl {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.icon-2xl {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

/* Icon containers with background */
.icon-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 8px;
}

.icon-container-sm {
    padding: 4px;
}

.icon-container-lg {
    padding: 12px;
}

/* Icon container backgrounds by type */
.icon-container-success {
    background: rgba(10, 191, 23, 0.15);
}

.icon-container-error {
    background: rgba(239, 68, 68, 0.15);
}

.icon-container-warning {
    background: rgba(245, 158, 11, 0.15);
}

.icon-container-info {
    background: rgba(59, 130, 246, 0.15);
}

.icon-container-neutral {
    background: var(--surface-alt-color);
}

/* Inline icon alignment */
.icon-inline {
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.icon-inline-end {
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
}

/* =========================================================================
   Sidebar Layout (#268)
   ========================================================================= */

.app-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1400;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    z-index: 1500;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease;
}

.app-main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--background-color);
}

/* Sidebar Branding */
.sidebar-header {
    padding: 30px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo img {
    max-height: 40px;
    width: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: none !important;
}

.sidebar-brand-name {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--sidebar-text);
    font-family: 'Sen', sans-serif;
}

/* Sidebar User Info */
.sidebar-user {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
}

.sidebar-user-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--sidebar-text);
    margin-bottom: 4px;
}

.sidebar-user-role {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sidebar-active-border);
    padding: 2px 8px;
    background: rgba(209, 183, 92, 0.1);
    border: 1px solid rgba(209, 183, 92, 0.2);
    border-radius: 4px;
}

.shadow-mode-banner {
    margin-top: 8px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    color: #0f172a;
    background: #d1b75c;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    letter-spacing: 0.05em;
}

.sidebar-request-id {
    font-size: 10px;
    color: var(--sidebar-text-muted);
    font-family: monospace;
    margin-bottom: 12px;
    text-align: center;
    opacity: 0.6;
    cursor: help;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 24px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--sidebar-text-muted);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.nav-item:hover {
    color: var(--sidebar-text);
    background-color: var(--sidebar-hover);
}

.nav-item.active {
    color: var(--sidebar-text);
    background-color: var(--sidebar-active-bg);
    border-left: 3px solid var(--sidebar-active-border);
    padding-left: 13px; /* Adjust for border */
}

.nav-item-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-item:hover .nav-item-icon,
.nav-item.active .nav-item-icon {
    opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-logout-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Mobile Toggle - Persistent Hamburger */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1600;
    background: var(--sidebar-bg);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    .sidebar-toggle {
        display: flex;
    }
    
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    
    .app-sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0,0,0,0.2);
    }
    
    .app-layout {
        flex-direction: column;
    }
}

/* Sidebar Context Switcher (#269) */
.sidebar-context-switcher {
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.context-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--sidebar-text-muted);
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.active-org-display {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.context-org-logo {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: contain;
    background: white;
}

.active-org-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--sidebar-text);
}

.btn-switch-org {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--sidebar-text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-switch-org:hover {
    background: rgba(255, 255, 255, 0.1);
}

.org-list {
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.org-link {
    display: block;
    padding: 10px 14px;
    color: var(--sidebar-text-muted);
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
}

.org-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--sidebar-text);
}

.org-link.active {
    background: rgba(209, 183, 92, 0.1);
    color: #d1b75c;
    font-weight: 700;
    border-left: 3px solid #d1b75c;
}

/* Global Centered Header Styles — Neat and Professional (#268) */
.page-centered-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    padding-top: 10px;
}

.header-back-nav {
    position: absolute;
    top: 0;
    left: 0;
}

.btn-back-arrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s;
}

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

.header-logo-container {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}

.header-logo-main {
    max-height: 80px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
}

.header-main-content h2, 
.header-main-content h1 {
    margin: 0 0 12px;
    color: var(--text-primary-color);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-badges {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.org-badge-large {
    display: inline-block;
    padding: 4px 12px;
    background: var(--surface-alt-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary-color);
}

.org-list-empty {
    padding: 12px 14px;
    font-size: 11px;
    color: var(--sidebar-text-muted);
    font-style: italic;
    text-align: center;
}

/* Compliance and Consent (SOC 2 / PCI) */
.compliance-box {
    margin: 24px 0;
    padding: 20px;
    background: var(--surface-alt-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.consent-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.consent-row input[type="checkbox"] {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.consent-row label {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary-color);
    cursor: pointer;
}

.compliance-note-small {
    margin: 12px 0 0 30px;
    font-size: 12px;
    color: var(--text-secondary-color);
    font-style: italic;
}

/* =========================================================================
   UI Refinement & Reporting Additions
   ========================================================================= */

/* =========================================================================
   Global Management Styles (Admin Only)
   ========================================================================= */

.global-mgmt-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-3);
}

.filters-card, .table-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-3);
    margin-bottom: var(--spacing-3);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-form .form-row {
    display: flex;
    gap: var(--spacing-3);
    align-items: flex-end;
    flex-wrap: wrap;
}

.search-group { flex: 2; min-width: 250px; }

.mgmt-table { width: 100%; border-collapse: collapse; text-align: left; }
.mgmt-table th { padding: 12px; border-bottom: 2px solid var(--border-color); color: var(--text-secondary-color); font-size: 13px; text-transform: uppercase; }
.mgmt-table td { padding: 15px 12px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }

.col-uuid code { font-size: 11px; background: var(--surface-alt-color); padding: 4px; border-radius: 4px; }

.status-updater { padding: 6px; border-radius: 4px; border: 1px solid var(--border-color); font-size: 13px; background: var(--surface-color); color: var(--text-primary-color); }

.pagination { display: flex; justify-content: center; align-items: center; gap: var(--spacing-3); margin-top: var(--spacing-3); }

.btn-page { padding: 8px 16px; background: var(--surface-color); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); color: var(--text-primary-color); text-decoration: none; }
.btn-page:hover { background: var(--surface-alt-color); }

.org-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--spacing-3);
    margin-top: var(--spacing-3);
}

.org-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-3) var(--spacing-2);
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.org-button:hover {
    border-color: var(--primary-color);
    background: var(--surface-alt-color);
}

.org-button.selected {
    border-color: var(--primary-color);
    background: var(--surface-alt-color);
    box-shadow: 0 0 0 3px var(--focus-shadow-color);
}

.org-thumbnail {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: var(--spacing-2);
}

.org-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    box-shadow: none;
    border: none;
}

.org-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary-color);
    text-align: center;
    word-break: break-word;
}

.org-role-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--surface-alt-color);
    color: var(--text-secondary-color);
    margin-top: var(--spacing-1);
    text-transform: capitalize;
}

/* OAuth & Social Login */
.oauth-divider {
    text-align: center;
    margin: var(--spacing-3) 0 var(--spacing-2);
    position: relative;
}

.oauth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
    background: var(--border-color);
}

.oauth-divider span {
    background: var(--surface-color);
    padding: 0 var(--spacing-2);
    position: relative;
    color: var(--text-secondary-color);
    font-size: 14px;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-1);
    width: 100%;
    padding: var(--spacing-2);
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: #3c4043;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.btn-google:hover {
    background: var(--background-color);
    box-shadow: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
}

.btn-google:active {
    background: var(--surface-alt-color);
}

/* =========================================================================
   Payment Form Specifics
   ========================================================================= */

.account-summary {
    background: var(--surface-alt-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-2) var(--spacing-3);
    margin-bottom: var(--spacing-3);
}

.account-summary h2 {
    text-align: left;
    font-size: 18px;
    margin: 0 0 var(--spacing-1) 0;
}

.account-summary-details {
    display: flex;
    gap: var(--spacing-3);
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--text-secondary-color);
}

/* LOA gate styles */
.loa-signing-section {
    background: var(--surface-alt-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-4) var(--spacing-3);
    margin-bottom: var(--spacing-3);
}

.loa-signing-section .loa-section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    margin-bottom: var(--spacing-2);
}

.loa-section-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    color: var(--primary-color);
}

.loa-signing-section h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary-color);
}

.loa-signing-section p {
    color: var(--text-secondary-color);
    line-height: 1.6;
    margin: 0 0 var(--spacing-3) 0;
}

.loa-error-message {
    background: var(--error-bg-color);
    border: 1px solid var(--error-border-color);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-1) var(--spacing-2);
    color: var(--error-text-color);
    font-size: 14px;
    margin-bottom: var(--spacing-2);
}

.loa-info-message {
    background: var(--warning-bg-color);
    border: 1px solid var(--warning-border-color);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-1) var(--spacing-2);
    color: var(--warning-text-color);
    font-size: 14px;
    margin-bottom: var(--spacing-2);
}

.loa-badge-signed,
.loa-badge-onfile {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-1);
    background: var(--success-bg-color);
    border: 1px solid var(--success-border-color);
    border-radius: 20px;
    padding: 4px var(--spacing-2);
    font-size: 13px;
    font-weight: 500;
    color: var(--success-text-color);
    margin-bottom: var(--spacing-2);
}

.loa-badge-icon {
    width: 14px;
    height: 14px;
}

/* Schedule terms preview */
.schedule-terms-preview {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-3);
    margin-bottom: var(--spacing-3);
}

.schedule-terms-preview h4 {
    margin: 0 0 var(--spacing-1) 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary-color);
}

.schedule-terms-subtitle {
    font-size: 13px;
    color: var(--text-secondary-color);
    margin: 0 0 var(--spacing-2) 0;
}

.schedule-terms-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-1) var(--spacing-2);
    margin-bottom: var(--spacing-2);
}

.schedule-terms-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.schedule-terms-row dt {
    font-size: 13px;
    color: var(--text-secondary-color);
}

.schedule-terms-row dd {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary-color);
}

.schedule-installments-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: var(--spacing-1);
}

.schedule-installments-table th {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary-color);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.schedule-installments-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary-color);
}

.schedule-overflow-note {
    font-size: 12px;
    color: var(--text-secondary-color);
    text-align: center;
    margin: var(--spacing-1) 0 0 0;
    font-style: italic;
}

/* Pay.js card container - Ring-fenced */
#paymentCardContainer {
    min-height: 50px;
    margin-bottom: var(--spacing-1);
}

#paymentCardContainer iframe {
    width: 100%;
    border: none;
    min-height: 50px;
}

.payment-unavailable {
    padding: var(--spacing-2) var(--spacing-2);
    background: var(--surface-alt-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary-color);
    font-size: 14px;
}

.payment-type-selector {
    margin-bottom: var(--spacing-2);
}

.payment-type-selector p {
    font-weight: 500;
    margin: 0 0 var(--spacing-1) 0;
    font-size: 14px;
}

.payment-type-selector label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: var(--spacing-3);
    cursor: pointer;
}

/* Password Requirements */
.password-requirements {
    background: var(--surface-alt-color);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-2);
    margin-bottom: var(--spacing-3);
}

.password-requirements p {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary-color);
    margin: 0 0 6px 0;
}

.password-requirements ul {
    margin: 0;
    padding-left: var(--spacing-2);
}

.password-requirements li {
    font-size: 13px;
    color: var(--text-secondary-color);
    margin-bottom: 3px;
}

.auth-links {
    text-align: center;
    margin-top: var(--spacing-3);
    padding-top: var(--spacing-3);
    border-top: 1px solid var(--border-color);
}

.btn-link {
    color: var(--primary-color);
    font-size: 14px;
    text-decoration: none;
    font-weight: 500;
}

.btn-link:hover {
    text-decoration: underline;
}

.standalone-error-container {
    max-width: 600px;
    margin: 100px auto;
    padding: var(--spacing-5);
    text-align: center;
    background: var(--surface-color);
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.standalone-error-code {
    font-size: 72px;
    font-weight: 700;
    color: var(--error-color);
    margin: 0;
}

.standalone-error-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary-color);
    margin: var(--spacing-2) 0 var(--spacing-1) 0;
}

.standalone-error-message {
    font-size: 16px;
    color: var(--text-secondary-color);
    margin: var(--spacing-1) 0 var(--spacing-4) 0;
    line-height: 1.6;
}

.standalone-error-details {
    background: var(--surface-alt-color);
    padding: var(--spacing-2);
    border-radius: var(--border-radius-sm);
    margin: var(--spacing-2) 0;
    text-align: left;
    font-size: 14px;
    color: var(--text-secondary-color);
}

.standalone-error-actions {
    margin-top: var(--spacing-4);
    display: flex;
    justify-content: center;
    gap: var(--spacing-2);
}

.standalone-error-footer {
    text-align: center;
    padding: var(--spacing-3);
    color: var(--text-secondary-color);
    font-size: 12px;
}

/* =========================================================================
   Policy & Article Styles (SOC-2 Informed)
   ========================================================================= */

.policy-container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: var(--spacing-3);
    box-sizing: border-box;
}

.policy-article {
    max-width: 100%;
    overflow-wrap: break-word;
}

.policy-header {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: var(--spacing-3);
    margin-bottom: var(--spacing-4);
}

.policy-header h1 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-1);
    font-size: 28px;
    font-weight: 700;
}

.policy-header p {
    color: var(--text-secondary-color);
    font-style: italic;
}

.policy-section {
    margin-bottom: var(--spacing-4);
}

.policy-section h2 {
    color: var(--primary-color);
    margin-top: var(--spacing-4);
    margin-bottom: var(--spacing-2);
    font-size: 20px;
    font-weight: 600;
}

.policy-section h3 {
    color: var(--text-primary-color);
    margin-top: var(--spacing-3);
    margin-bottom: var(--spacing-1);
    font-size: 18px;
    font-weight: 600;
}

.policy-section p {
    line-height: 1.6;
    margin-bottom: var(--spacing-2);
}

.policy-section ul,
.policy-section ol {
    line-height: 1.8;
    margin-left: var(--spacing-3);
    margin-bottom: var(--spacing-2);
}

.policy-section li {
    margin-bottom: var(--spacing-1);
}
/* Utilities */
.text-center { text-align: center; }
.mt-1 { margin-top: var(--spacing-1); }
.mt-2 { margin-top: var(--spacing-2); }
.mt-3 { margin-top: var(--spacing-3); }
.mt-4 { margin-top: var(--spacing-4); }
.mb-1 { margin-bottom: var(--spacing-1); }
.mb-2 { margin-bottom: var(--spacing-2); }
.mb-3 { margin-bottom: var(--spacing-3); }
.mb-4 { margin-bottom: var(--spacing-4); }
.p-2 { padding: var(--spacing-2); }
.p-3 { padding: var(--spacing-3); }
.p-4 { padding: var(--spacing-4); }
.display-none { display: none; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-primary { color: var(--text-primary-color); }
.text-secondary { color: var(--text-secondary-color); }
.text-success { color: var(--success-color); }
.text-error { color: var(--error-color); }
.text-warning { color: var(--warning-color); }
.text-info { color: var(--info-color); }
.text-white { color: #ffffff; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.inline-flex-center { display: inline-flex; align-items: center; justify-content: center; }

.mx-auto { margin-left: auto; margin-right: auto; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 28px; }
.text-4xl { font-size: 32px; }
.text-5xl { font-size: 48px; }
.text-6xl { font-size: 64px; }
.text-7xl { font-size: 72px; }
.inline-block { display: inline-block; }
.block { display: block; }
.flex { display: flex; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.gap-1 { gap: var(--spacing-1); }
.gap-2 { gap: var(--spacing-2); }
.gap-3 { gap: var(--spacing-3); }
.w-auto { width: auto; }
.h-auto { height: auto; }
.max-w-xs { max-width: 400px; }
.max-w-sm { max-width: 600px; }
.max-w-md { max-width: 800px; }
.max-w-lg { max-width: 1000px; }
.max-w-xl { max-width: 1200px; }

.pill-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.pill-label.blue { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.pill-label.green { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.pill-label.red { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.pill-label.gray { background: #f3f4f6; color: #374151; border: 1px solid #e5e7eb; }
.pill-label.yellow { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }

/* Standardized Button Sizing for Proximity */
.btn-action,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-edit,
.btn-success,
.btn-payment,
.btn-export-csv,
.btn-report,
.btn-report-small {
    min-height: 42px !important;
    height: 42px !important;
    padding: 0 24px !important; /* Slightly more horizontal padding */
    font-size: 14px !important;
    font-weight: 700 !important; /* Bolder */
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
}

/* Distinct color for reports */
.btn-report,
.btn-report-small {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border: none !important;
}

.btn-report:hover,
.btn-report-small:hover {
    background-color: #334155 !important;
    transform: translateY(-1px) !important;
}

.btn-small {
    min-height: 32px !important;
    height: 32px !important;
    padding: 0 16px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    border-radius: 4px !important;
}

/* centering single items */
.page-centered-header,
.empty-state,
.no-data-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    min-height: 200px;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.empty-state,
.no-data-container {
    background: var(--surface-alt-color) !important;
    border: 1px dashed var(--border-color) !important;
    padding: 40px !important;
}

/* =============================================================================
   Branding & Logos - Unified Finesse
   ============================================================================= */
.org-logo-unified,
.header-logo-main,
.org-logo-large,
.context-org-logo,
.header-logo {
    max-height: 48px;
    width: auto !important;
    object-fit: contain !important;
    display: block;
}

/* =============================================================================
   Table & Grid Stability - Fixed Layout
   ============================================================================= */
.accounts-table,
.data-table,
.report-table {
    table-layout: fixed;
    width: 100% !important;
    border-collapse: collapse;
}

/* =============================================================================
   List Alignment Fix (Notice Cards)
   ============================================================================= */
.notice-card ul,
.loa-signing-section ul {
    margin-left: 28px !important;
    padding-left: 0 !important;
    margin-top: 12px !important;
    list-style-type: disc !important;
}

.notice-card li,
.loa-signing-section li {
    margin-bottom: 8px !important;
    line-height: 1.6 !important;
    color: var(--text-primary-color) !important;
}

/* =============================================================================
   Refined Summary Highlighting (Span-based)
   ============================================================================= */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.summary-item {
    background: var(--surface-color);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
}

/* Remove block fill, use span highlighting to preserve borders */
.summary-item.highlight {
    background: var(--surface-color) !important;
}

.summary-item .label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.summary-item .value {
    display: block;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary-color);
}

.summary-item.highlight .value {
    color: var(--primary-color);
    font-weight: 700;
}

.summary-item.highlight.green .value {
    color: #059669; /* Emerald 600 */
}

/* =============================================================================
   Note Guide (User Guide) Styles
   ============================================================================= */
.guide-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.guide-header {
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.guide-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary-color);
}

.guide-section-title {
    font-size: 20px;
    font-weight: 600;
    margin: 36px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
    color: var(--text-primary-color);
}

/* Callout boxes */
.callout {
    padding: 16px 20px;
    border-radius: 8px;
    margin: 20px 0;
    font-size: 14px;
    line-height: 1.6;
    border-left: 4px solid transparent;
}

.callout strong {
    display: block;
    margin-bottom: 4px;
    font-size: 15px;
}

.callout-info { background: #eff6ff; border-left-color: #3b82f6; color: #1e40af; }
.callout-warning { background: #fffbeb; border-left-color: #f59e0b; color: #92400e; }
.callout-danger { background: #fef2f2; border-left-color: #ef4444; color: #991b1b; }
.callout-tip { background: #f0fdf4; border-left-color: #10b981; color: #166534; }

/* Steps */
.guide-steps {
    list-style: none;
    margin: 24px 0;
    padding: 0;
    counter-reset: guide-step;
}

.guide-steps li {
    counter-increment: guide-step;
    padding: 16px 16px 16px 56px;
    position: relative;
    margin-bottom: 12px;
    background: var(--surface-alt-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.guide-steps li::before {
    content: counter(guide-step);
    position: absolute;
    left: 16px;
    top: 16px;
    width: 28px;
    height: 28px;
    background: var(--text-primary-color);
    color: #fff;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Doc Tables */
.doc-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.doc-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--surface-alt-color);
    color: var(--text-secondary-color);
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
}

.doc-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.field-name { font-weight: 700; color: var(--text-primary-color); }
.ui-ref { font-weight: 600; color: var(--primary-color); background: rgba(59, 130, 246, 0.05); padding: 1px 4px; border-radius: 3px; }

.header-badges {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    margin-top: 10px !important;
}

/* Payment Form Container & Footer Spacing */
.payment-container {
    max-width: 960px !important;
    margin: 3rem auto 8rem !important;
    padding: 0 3rem !important;
    box-sizing: border-box !important;
}

@media (min-width: 992px) {
    .payment-container {
        padding: 0 6rem !important;
    }
}

.payment-form-footer {
    margin: 4rem 0 !important;
    padding: 4rem !important;
    background: var(--surface-alt-color);
    border-radius: 16px !important;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
}

.compliance-box {
    margin: 3rem 0 !important;
    padding: 2.5rem !important;
    background: #f8fafc !important;
}

/* Table Header Refinement */
.data-table thead th,
.report-table thead th {
    background: var(--surface-alt-color);
    color: var(--text-secondary-color);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
}

/* Widget Container for Review Queue */
.widget-container {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.widget-header {
    background: var(--surface-alt-color);
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.widget-body {
    padding: 0;
    max-height: 500px;
    overflow-y: auto;
}

/* Guide Tabs */
.guide-tab-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-4);
    gap: 8px;
    /* #665: the role-title tabs fit on one row and wrap on narrow screens —
       no horizontal scrolling, so don't render a (persistent) scrollbar track. */
    overflow-x: visible;
    padding: 4px 4px 0;
}

.guide-tab {
    flex: 0 0 auto;
    padding: 8px 16px;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary-color);
    transition: all 0.2s ease;
    margin-bottom: -1px;
}

.guide-tab:hover {
    color: var(--text-primary-color);
    background: var(--surface-alt-color);
}

.guide-tab.active {
    color: var(--primary-color);
    background: var(--surface-color);
    border-color: var(--border-color);
    border-bottom: 1px solid var(--surface-color);
    box-shadow: 0 -2px 10px rgba(0, 48, 73, 0.05);
    filter: saturate(1.2);
}

/* MFA / Auth Pages */
.auth-container-narrow {
    max-width: 400px;
    margin: var(--spacing-4) auto;
    padding: var(--spacing-4);
}

.auth-container-medium {
    max-width: 600px;
    margin: var(--spacing-4) auto;
    padding: var(--spacing-4);
}

.qr-code-container {
    text-align: center;
    margin: var(--spacing-4) auto;
    max-width: 200px;
}

.qr-code-img {
    width: 100%;
    display: block;
}

.secret-key-box {
    background: var(--surface-alt-color);
    padding: var(--spacing-2);
    word-break: break-all;
    margin: var(--spacing-2) 0;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.w-100 {
    width: 100%;
}

.border-top-none {
    border-top: none !important;
}

.pt-0 {
    padding-top: 0 !important;
}

/* ===== Org Users page — action-panel overflow guard (#663) ===== */
/* Prevent the button column from escaping the card at any viewport width.
   The inline template styles own the detailed layout; this is the safety net. */
.action-buttons-column {
    min-width: 0;
    max-width: 100%;
}
