/* Modern Payment Prototype Styles - v3 Responsive High Fidelity */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Brand Colors */
    --primary: #037b90;
    /* Teal */
    --primary-dark: #026475;
    --primary-light: #e0f2f5;

    --secondary: #ff7f50;
    /* Coral */
    --secondary-dark: #e06b40;

    --accent: #0ea5e9;

    /* Neutral / Backgrounds */
    --bg-body: #f8fafc;
    /* Slate 50 */
    --bg-white: #ffffff;
    --bg-sidebar: #f1f5f9;
    /* Slate 100 - Light Gray Sidebar */
    --border-color: #cbd5e1;

    --text-main: #0f172a;
    /* Slate 900 */
    --text-sidebar: #334155;
    /* Slate 700 */
    --text-muted: #64748b;

    /* Functional */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
}

/* Auth Page Specifics */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.auth-card {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border-top: 4px solid var(--primary);
    padding: 40px;
    /* Added padding to make it look like a card */
}

/* Notifications */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: bounce 0.5s ease;
}

@keyframes bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* App Shell */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    /* Prevent shrinking */
    z-index: 50;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
}

.logo i {
    color: var(--secondary);
}

.nav-item {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.nav-item:hover {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(3, 123, 144, 0.3);
}

/* Nested Navigation */
.nav-sub-item {
    font-size: 0.9rem;
    padding: 10px 15px 10px 35px;
    /* Increased left padding */
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 8px;
}

.nav-sub-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.nav-sub-item.active {
    background: #e0f2fe;
    color: var(--primary);
    font-weight: 600;
}

.nav-item-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.nav-chevron {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.nav-group {
    display: none;
    /* hidden by default */
    padding-bottom: 5px;
}

.nav-group.open {
    display: block;
}

.nav-item.open .nav-chevron {
    transform: rotate(180deg);
}

/* Flyout submenu styling */
/* BUG: Submenu flyout not displaying correctly - ensure proper positioning and z-index */
.nav-flyout {
    position: fixed;
    /* changed from absolute to fixed for consistent viewport positioning */
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    min-width: 200px;
    z-index: 1000;
    /* increased to ensure visibility */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: none;
    padding: 5px 0;
    pointer-events: auto;
}

.nav-flyout .nav-sub-item {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-sidebar);
    white-space: nowrap;
}

.nav-flyout .nav-sub-item:hover {
    background: var(--bg-sidebar);
    color: var(--primary);
}


/* Level 3 nesting */
.nav-sub-sub-item {
    font-size: 0.85rem;
    padding: 8px 15px 8px 50px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
}

.nav-sub-sub-item:hover {
    color: var(--primary);
}

.menu-badge {
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0 6px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: 10px;
}

.menu-badge.dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border-radius: 50%;
    margin-right: 12px;
    /* Slight adjustment for alignment */
    min-height: 0;
    /* Override */
    font-size: 0;
    /* Hide text if any accidentally set */
}



/* Main Content Area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: #f8fafc;
    /* Lighter background for content */
}

/* Top Navigation Bar */
.topbar {
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid #e2e8f0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
    margin: 0;
}

.page-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    /* Ensure internal grid fits */
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Flyout Menu Styles */
.nav-flyout {
    position: fixed;
    background: white;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    border-radius: 0 8px 8px 0;
    padding: 10px 0;
    z-index: 9999;
    min-width: 260px;
    /* Wider */
    max-height: 90vh;
    /* Prevent off-screen */
    overflow-y: auto;
    display: none;
}

.nav-flyout.visible {
    display: block;
    animation: slideRight 0.2s ease;
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.nav-flyout .nav-sub-item {
    padding: 8px 24px;
    margin: 0;
    border-radius: 0;
    color: var(--primary);
    /* Teal-ish links as per screenshot */
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-flyout .nav-sub-item:hover {
    background: #f8fafc;
    color: var(--primary-dark);
    padding-left: 28px;
    /* Slight movement */
}

/* Grouped Flyout Headers */
.flyout-group {
    margin-bottom: 15px;
}

.flyout-header {
    padding: 10px 20px 5px 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    /* Muted header */
    letter-spacing: 0.5px;
}

/* Common Table Styles */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.data-table th {
    background: #f8fafc;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid #e2e8f0;
    text-align: left;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    color: var(--text-main);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: #f1f5f9;
}

/* Mobile Toggle & Overlay */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    margin-right: 15px;
}

.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 45;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        /* Hide by default */
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        width: 280px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .nav-overlay.open {
        display: block;
        opacity: 1;
    }

    .mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Adjust padding for mobile */
    .topbar {
        padding: 1rem;
    }

    .page-container {
        padding: 1rem;
    }

    /* Adjust grids */
    .grid-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Stepper adjustments */
    .stepper {
        flex-direction: column;
        padding-left: 20px;
    }

    .stepper::before {
        display: none;
    }

    .step-item {
        flex-direction: row;
        text-align: left;
        align-items: flex-start;
        margin-bottom: 20px;
        border-left: 2px solid #e2e8f0;
        padding-left: 20px;
        padding-bottom: 0;
    }

    .step-item:last-child {
        border: none;
    }

    .step-marker {
        position: absolute;
        left: -17px;
        background: white;
        margin-bottom: 0;
        margin-right: 15px;
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
}

/* Components */
.panel {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.stat-card {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.stat-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary);
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0;
    color: var(--text-main);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    background: white;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(3, 123, 144, 0.1);
}

.form-control[readonly] {
    background: #f8fafc;
    color: #475569;
    cursor: default;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin: 20px 0 10px 10px;
    letter-spacing: 0.5px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-outline {
    background: white;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
}

.btn-outline:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

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

/* Status Badges */
.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.badge-pending {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #ffedd5;
}

.badge-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #dcfce7;
}

.badge-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fee2e2;
}

.badge-neutral {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* Utilities */
.text-right {
    text-align: right;
}

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

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1e293b;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Interactive Graph Styles */
#process-canvas {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    position: relative;
    overflow-x: auto;
    /* Scroll enabled */
    overflow-y: hidden;
    width: 100%;
    /* Height set by JS */
    /* SVG containment */
    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) #f1f5f9;
}

#process-canvas::-webkit-scrollbar {
    height: 8px;
}

#process-canvas::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

#process-canvas::-webkit-scrollbar-track {
    background: transparent;
}

/* Custom Modal Styles */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-modal-overlay.open {
    opacity: 1;
}

.custom-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-modal-overlay.open .custom-modal-content {
    transform: scale(1);
}

.modal-header {
    margin-bottom: 12px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.modal-body {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    margin-top: 8px;
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(3, 123, 144, 0.1);
}

.modal-textarea {
    min-height: 100px;
    resize: vertical;
    overflow-y: hidden;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.graph-node {
    position: absolute;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px;
    width: 160px;
    text-align: center;
    font-size: 0.85rem;
    cursor: grab;
    user-select: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s, transform 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    color: var(--text-sidebar);
    line-height: 1.4;
}

.graph-node:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.graph-node.type-root {
    border-top: 4px solid var(--primary);
    background: linear-gradient(to bottom, #f0f9ff, white);
}

.graph-node.type-finance {
    border-top: 4px solid var(--secondary);
}

.graph-node.type-vc {
    border-top: 4px solid #7c3aed;
}

@keyframes dash {
    to {
        stroke-dashoffset: -20;
    }
}

/* User Avatar & Dropdown */
.user-menu-container {
    display: inline-block;
    position: relative;
    margin-left: 20px;
}

.user-avatar-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 30px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.user-avatar-trigger:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.user-info-text {
    text-align: right;
    line-height: 1.2;
}

.user-info-text .u-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    display: block;
}

.user-info-text .u-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
}

.avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 2px solid white;
}

.u-chevron {
    font-size: 0.75rem;
    color: #94a3b8;
    transition: transform 0.2s;
}

.user-avatar-trigger:hover .u-chevron {
    color: var(--text-main);
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 120%;
    /* Below trigger */
    right: 0;
    width: 240px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    padding: 8px 0;
    display: none;
    /* Hidden by default */
    z-index: 1000;
    animation: slideDown 0.2s ease-out;
    transform-origin: top right;
}

.dropdown-menu.show {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-header {
    padding: 12px 20px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
    margin-top: -8px;
    /* Cover padding */
    margin-bottom: 8px;
}

.dropdown-header strong {
    color: var(--text-main);
    font-size: 0.95rem;
}

.dropdown-header .muted {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s;
    cursor: pointer;
}

.dropdown-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 0.9rem;
}

.dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 6px 0;
}

.text-danger {
    color: var(--danger) !important;
}

.text-danger:hover {
    background: #fef2f2;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.data-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
    padding: 12px 16px;
    font-size: 0.85rem;
    border-bottom: 2px solid #e2e8f0;
}

.data-table td {
    padding: 12px 16px;
    color: var(--text-main);
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Grid Utilities */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

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