// components/enterprise_terms.el - Enterprise Agreement page.
// Returns complete HTML using the shared page shell from styles.el.

from styles import { page_open, page_close }
from nav    import { nav }

fn enterprise_terms_page() -> String {
    return page_open() + enterprise_terms_body() + page_close()
}

fn section(num: String, title: String, body: String) -> String {
    return "
  <div style=\"margin-bottom:3rem\">
    <div style=\"display:flex;align-items:baseline;flex-wrap:wrap;gap:0.5rem 1rem;margin-bottom:1.25rem;border-bottom:1px solid var(--border);padding-bottom:0.75rem\">
      <span style=\"font-family:var(--body);font-size:0.75rem;font-weight:600;letter-spacing:0.15em;text-transform:uppercase;color:var(--navy-65);flex-shrink:0\">&#167; " + num + "</span>
      <h2 style=\"font-family:var(--head);font-size:1.25rem;font-weight:600;color:var(--t1);min-width:0;word-break:break-word\">" + title + "</h2>
    </div>
    " + body + "
  </div>"
}

fn p(text: String) -> String {
    return "<p style=\"font-family:var(--body);font-weight:300;font-size:0.9375rem;color:var(--t2);line-height:1.8;margin-bottom:1rem\">" + text + "</p>"
}

fn p_last(text: String) -> String {
    return "<p style=\"font-family:var(--body);font-weight:300;font-size:0.9375rem;color:var(--t2);line-height:1.8\">" + text + "</p>"
}

fn p_caps(text: String) -> String {
    return "<p style=\"font-family:var(--body);font-size:0.875rem;font-weight:600;color:var(--t1);line-height:1.7;margin-bottom:1rem\">" + text + "</p>"
}

fn enterprise_terms_body() -> String {
    return nav() + "
<div style=\"max-width:720px;margin:0 auto;padding:6rem clamp(1rem,5vw,2.5rem) 8rem;box-sizing:border-box;overflow-wrap:break-word;word-break:break-word\">
  <div style=\"margin-bottom:3rem\">
    <a href=\"/\" style=\"font-family:var(--body);font-size:0.75rem;font-weight:500;letter-spacing:0.15em;text-transform:uppercase;color:var(--navy);text-decoration:none\">&#8592; Neuron</a>
  </div>
  <div style=\"margin-bottom:4rem;border-bottom:1px solid var(--border);padding-bottom:3rem\">
    <p class=\"label\" style=\"margin-bottom:1rem\">Legal</p>
    <h1 style=\"font-family:var(--head);font-size:clamp(2rem,4vw,3rem);font-weight:600;color:var(--t1);margin-bottom:0.75rem;line-height:1.1\">Enterprise Agreement</h1>
    <p style=\"font-family:var(--body);font-size:0.875rem;color:var(--t3)\">Effective May 1, 2026 &nbsp;&middot;&nbsp; Neuron, LLC</p>
  </div>

" + section("1", "Parties and Scope",
    p("This Enterprise Agreement (&#34;Agreement&#34;) is between Neuron, LLC (&#34;Neuron&#34;) and the organization entering into an enterprise relationship (&#34;Customer&#34;). It governs all enterprise deployments, including Team, Enterprise, and Private Cloud tiers.")
  + p_last("This Agreement supplements the Neuron Terms of Service. In the event of conflict, this Agreement controls for enterprise use. The parties are bound by the Order Form executed at time of deployment, which specifies tier, seat count, term, and pricing.")
) + section("2", "License Grant and Usage Rights",
    p("Subject to the terms of this Agreement and timely payment of fees, Neuron grants Customer a limited, non-exclusive, non-transferable, non-sublicensable license to deploy and use the Neuron platform (&#34;Software&#34;) solely for Customer&#39;s internal business purposes during the Term.")
  + p("The license is scoped to the number of authorized seats, devices, or instances specified in the Order Form. Customer may not exceed the licensed scope without executing a seat expansion. Neuron will not invoice retroactively for inadvertent overage of fewer than 10% of contracted seats if Customer notifies Neuron and brings usage into compliance within 30 days.")
  + p_last("Customer may not: (a) sublicense, resell, or distribute the Software to third parties; (b) reverse engineer, decompile, or attempt to extract source code or trained model weights; (c) use the Software to build a competing product; or (d) remove or obscure any proprietary notices. Private Cloud deployments may be deployed to Customer&#39;s infrastructure but may not be transferred or made available to entities other than Customer&#39;s own employees and contractors under appropriate confidentiality obligations.")
) + section("3", "Data and Privacy",
    p("Neuron&#39;s architecture is designed to minimize data exposure. In private cloud and air-gapped deployments, no data leaves Customer&#39;s infrastructure. Neuron has no access to Customer data in these configurations.")
  + p("In cloud-hosted deployments, Neuron processes Customer data solely to deliver the contracted services. Customer data is stored in an isolated tenant, is not commingled with other customers&#39; data, and is not used for model training, analytics, or any purpose beyond service delivery. When Customer activates network features - including relay, peer-to-peer sync, or collaborative features - data required to operate those features may be transmitted to other network participants or Neuron infrastructure; such transmission is limited to the minimum required, excludes Customer&#39;s memory and conversation history unless Customer explicitly enables a sharing feature, and is used only to deliver the activated feature. Network features route data through Neuron&#39;s messaging backplane. That data is encrypted end-to-end - Neuron cannot read it - and is not stored or retained after transmission.")
  + p("Customer owns all data processed through the platform. Customer data is not Customer&#39;s data in the legal sense of the term as used in data processing frameworks - Customer is the controller. Neuron is the processor. Upon termination, Customer data is returned or destroyed within 30 days at Customer&#39;s election. We do not retain copies.")
  + p_last("Where required by applicable law, Neuron will execute a Data Processing Agreement (DPA) as a supplement to this Agreement. Contact enterprise@neurontechnologies.ai to initiate. Neuron will notify Customer within 72 hours of becoming aware of any confirmed breach affecting Customer data.")
) + section("4", "Values Alignment",
    p("Neuron is built on the principle that AI should expand human capability, not replace it. We are selective about the organizations we work with.")
  + p("Customer represents that it does not intend to use Neuron primarily as a tool to eliminate employee positions, reduce headcount through automation in ways that harm workers, or otherwise use the platform in ways inconsistent with the welfare of the people who work in Customer&#39;s organization.")
  + p("Neuron reserves the right to decline, not renew, or terminate any enterprise agreement where Neuron determines, in its reasonable judgment, that the Customer&#39;s use of the platform is fundamentally misaligned with these principles. Termination under this section is subject to the notice and cure provisions of &#167; 10.")
  + p_last("We will not enter into agreements with organizations whose primary business model, as Neuron determines in good faith, depends on practices that systematically harm workers, small businesses, or communities. This is not a standard clause in most software agreements. We mean it.")
) + section("5", "Service Levels and Support",
    p("For cloud-hosted deployments, Neuron targets 99.9% monthly uptime, excluding scheduled maintenance windows (communicated at least 48 hours in advance) and circumstances outside Neuron&#39;s reasonable control. In the event Neuron fails to meet this target in a given calendar month, Customer may request a service credit equal to 5% of that month&#39;s fees for each full percentage point of availability below the target, up to a maximum of 30% of monthly fees. Credits are the sole and exclusive remedy for availability failures.")
  + p("For on-premises and private cloud deployments, Customer is responsible for infrastructure availability. Neuron&#39;s SLA obligations apply only to software defects in the distributed build, not to Customer&#39;s infrastructure choices.")
  + p_last("Support is provided by email at enterprise@neurontechnologies.ai. Neuron will acknowledge critical issues (complete service outage or data loss risk) within 4 business hours and provide a status update within 24 hours. Standard issues are acknowledged within 2 business days. Neuron does not guarantee resolution timelines for issues requiring platform changes.")
) + section("6", "Security and Compliance",
    p("Neuron implements security controls commensurate with enterprise software handling sensitive user data. These include: encryption in transit (TLS 1.2+) and at rest for cloud-hosted services; role-based access controls; audit logging at the infrastructure layer; and regular internal security reviews.")
  + p("Neuron will pursue SOC 2 Type II certification and will provide Customer with the most recent available report upon request under a signed NDA. Until certification is achieved, Neuron will make available a written summary of security controls upon request.")
  + p_last("Customer is responsible for: (a) maintaining the security of credentials and API keys used to access the platform; (b) configuring access controls for Customer&#39;s own users; (c) compliance with applicable law with respect to the data Customer chooses to input into the platform; and (d) conducting its own security evaluation appropriate to its risk profile before deployment in regulated environments.")
) + section("7", "Confidentiality",
    p("Each party (&#34;Receiving Party&#34;) agrees to protect the other party&#39;s (&#34;Disclosing Party&#34;) Confidential Information with the same degree of care it uses to protect its own confidential information, but no less than reasonable care. &#34;Confidential Information&#34; means any non-public information disclosed by the Disclosing Party that is designated as confidential or that reasonably should be understood to be confidential given the nature of the information and circumstances of disclosure.")
  + p("Confidential Information does not include information that: (a) becomes publicly known through no breach by the Receiving Party; (b) was already known to the Receiving Party before disclosure; (c) is received from a third party without restriction; or (d) was independently developed by the Receiving Party without use of the Confidential Information.")
  + p_last("These obligations survive termination of this Agreement for three years. Receiving Party may disclose Confidential Information to the extent required by law or court order, provided that Receiving Party gives Disclosing Party prompt written notice and cooperates with any effort to obtain a protective order.")
) + section("8", "Intellectual Property",
    p("Neuron retains all right, title, and interest in and to the Software, including all improvements, updates, and derivative works, and all intellectual property rights therein. No title to or ownership of the Software transfers to Customer under this Agreement.")
  + p("Customer retains all right, title, and interest in and to Customer&#39;s data, including inputs, memorys, and outputs generated through Customer&#39;s use of the platform. Neuron does not claim ownership of Customer&#39;s outputs. Customer is responsible for evaluating the accuracy and appropriateness of outputs before relying on them.")
  + p_last("This Agreement does not grant Customer any right to use Neuron&#39;s trademarks, trade names, or logos except as expressly authorized in writing. Neuron Aligned Partner certification (&#167; 14) includes a limited right to use the partner designation as specified in the Partner Addendum.")
) + section("9", "Indemnification",
    p("Neuron will defend Customer against third-party claims that the Software, as provided by Neuron and used in accordance with this Agreement, infringes a valid patent, copyright, or trademark, and will indemnify Customer for damages finally awarded in such a proceeding or agreed in settlement. This obligation does not apply to claims arising from: (a) Customer&#39;s modification of the Software; (b) Customer&#39;s combination of the Software with third-party products or data not provided by Neuron; or (c) Customer&#39;s use of the Software in violation of this Agreement.")
  + p_last("Customer will defend Neuron against third-party claims arising from Customer&#39;s use of the platform in violation of applicable law, this Agreement, or the rights of third parties, and will indemnify Neuron for damages finally awarded or agreed in settlement. Each party must promptly notify the other of any claim for which indemnification may be sought and must cooperate reasonably in the defense.")
) + section("10", "Term and Termination",
    p("This Agreement begins on the Effective Date specified in the Order Form and continues for the initial term stated therein, typically twelve months. Unless either party provides written notice of non-renewal at least 30 days before the end of the then-current term, this Agreement automatically renews for successive one-year terms at the pricing in effect at renewal.")
  + p("Either party may terminate this Agreement for material breach upon 30 days&#39; written notice if the breach remains uncured at the end of that period. Neuron may terminate immediately upon written notice if Customer breaches &#167; 2 (unauthorized use of the Software) or &#167; 7 (confidentiality obligations).")
  + p("Neuron may terminate this Agreement under &#167; 4 (Values Alignment) with 60 days&#39; written notice if Neuron determines in good faith that Customer&#39;s use of the platform is materially and persistently misaligned with the principles stated therein. Neuron will provide Customer the opportunity to respond and demonstrate alignment before termination takes effect.")
  + p_last("Upon termination: (a) all licenses immediately terminate; (b) Customer must cease use of the Software; (c) each party will return or destroy the other&#39;s Confidential Information upon request; and (d) Neuron will make Customer&#39;s data available for export for 30 days, after which it will be destroyed. Sections 3 (data ownership and destruction), 7 (confidentiality), 8 (intellectual property), 9 (indemnification), 11 (limitation of liability), and 13 (governing law) survive termination.")
) + section("11", "Limitation of Liability",
    p_caps("NEURON&#39;S TOTAL LIABILITY UNDER THIS AGREEMENT SHALL NOT EXCEED THE FEES PAID BY CUSTOMER IN THE TWELVE MONTHS PRECEDING THE CLAIM.")
  + p_caps("NEITHER PARTY SHALL BE LIABLE FOR INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, EVEN IF ADVISED OF THEIR POSSIBILITY.")
  + p_last("These limitations do not apply to: (a) Customer&#39;s payment obligations; (b) breaches of &#167; 7 (confidentiality); (c) a party&#39;s indemnification obligations under &#167; 9; or (d) a party&#39;s gross negligence or willful misconduct.")
) + section("12", "Warranties and Disclaimers",
    p("Neuron warrants that: (a) the Software will perform materially in accordance with its published documentation during the Term; (b) Neuron has the authority to enter into this Agreement and grant the licenses herein; and (c) to Neuron&#39;s knowledge, the Software does not knowingly infringe any third-party intellectual property rights.")
  + p("Customer&#39;s exclusive remedy for a warranty breach under (a) is for Neuron to use commercially reasonable efforts to correct the non-conformity, or if correction is not commercially practicable within 30 days, to terminate the Agreement and receive a pro-rata refund of prepaid fees for the unused portion of the Term.")
  + p_caps("EXCEPT AS EXPRESSLY SET FORTH IN THIS SECTION, THE SOFTWARE IS PROVIDED &#34;AS IS.&#34; NEURON DISCLAIMS ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.")
  + p_last("AI-generated outputs are probabilistic and may be inaccurate, incomplete, or inappropriate for specific contexts. Customer is responsible for reviewing outputs before relying on them for any consequential decision. Neuron does not warrant that outputs will be accurate, complete, or suitable for any particular purpose.")
) + section("13", "Governing Law and Disputes",
    p("This Agreement is governed by the laws of the State of Delaware, without regard to conflict of law principles.")
  + p_last("The parties agree to attempt to resolve disputes through good-faith negotiation before initiating formal proceedings. If negotiation fails within 30 days of written notice of the dispute, disputes shall be resolved by binding arbitration under AAA Commercial Arbitration Rules in Wilmington, Delaware, except that either party may seek injunctive relief in court for IP or confidentiality violations without first arbitrating.")
) + "

  <!-- Neuron Aligned Partner Program - highlighted section -->
  <div style=\"margin-bottom:3rem;padding:clamp(1.25rem,4vw,2rem) clamp(1rem,4vw,2.25rem);border:1.5px solid rgba(0,82,160,.35);background:rgba(0,82,160,.03);box-sizing:border-box\">
    <div style=\"display:flex;align-items:baseline;flex-wrap:wrap;gap:0.5rem 1rem;margin-bottom:1.25rem;border-bottom:1px solid rgba(0,82,160,.20);padding-bottom:0.75rem\">
      <span style=\"font-family:var(--body);font-size:0.75rem;font-weight:600;letter-spacing:0.15em;text-transform:uppercase;color:var(--navy-65);flex-shrink:0\">&#167; 14</span>
      <h2 style=\"font-family:var(--head);font-size:1.25rem;font-weight:600;color:var(--t1);min-width:0;word-break:break-word\">Neuron Aligned Partner Program</h2>
    </div>

    <p style=\"font-family:var(--body);font-weight:300;font-size:0.9375rem;color:var(--t2);line-height:1.8;margin-bottom:1rem\">Participation in the Neuron Aligned Partner Program is entirely voluntary. No enterprise customer is required to participate, and the standard enterprise relationship under this Agreement is not conditioned on it.</p>

    <p style=\"font-family:var(--body);font-weight:300;font-size:0.9375rem;color:var(--t2);line-height:1.8;margin-bottom:1rem\">An organization that chooses to participate executes a Neuron Aligned Partner Addendum (&#34;Partner Addendum&#34;), a separate document supplementing this Agreement. In the Partner Addendum, Customer makes the following certification:</p>

    <div style=\"margin:1.5rem 0;padding:1.25rem 1.5rem;border-left:3px solid var(--navy);background:rgba(0,82,160,.04);box-sizing:border-box\">
      <p style=\"font-family:var(--body);font-weight:400;font-size:0.9375rem;color:var(--t1);line-height:1.8;font-style:italic\">&#34;We are deploying Neuron to make our people more capable, not to eliminate them. Reducing headcount is not a primary objective of this deployment. We commit to using this technology in a manner consistent with the welfare of our workforce, and we will notify Neuron if our intentions change in ways that materially contradict this commitment.&#34;</p>
    </div>

    <p style=\"font-family:var(--body);font-weight:400;font-size:0.9rem;color:var(--t1);line-height:1.6;margin-bottom:0.75rem\">Partners who execute the Partner Addendum receive:</p>
    <ul style=\"font-family:var(--body);font-weight:300;font-size:0.9rem;color:var(--t2);line-height:1.8;padding-left:1.25rem;margin-bottom:1.5rem\">
      <li style=\"margin-bottom:0.4rem\">Preferential per-seat pricing - specific discount terms are disclosed at the time of certification and reflected in the Order Form</li>
      <li style=\"margin-bottom:0.4rem\">Membership in the Neuron Aligned Partner Network, a private community of organizations that have made the same commitment</li>
      <li style=\"margin-bottom:0.4rem\">Optional public listing as a Neuron Aligned Partner - a signal to employees and the market that AI is being used to expand human capability, not eliminate it</li>
      <li style=\"margin-bottom:0.4rem\">Priority consideration in the enterprise roadmap - Aligned Partners are given more weight in feature prioritization and deployment planning</li>
      <li>Direct access to Neuron leadership for roadmap input and partnership discussions</li>
    </ul>

    <p style=\"font-family:var(--body);font-weight:300;font-size:0.9375rem;color:var(--t2);line-height:1.8;margin-bottom:1rem\">The certification is self-attested and made in good faith. Neuron does not audit deployment usage to verify the commitment, but relies on the integrity of the partner&#39;s representation. If Neuron determines, based on credible evidence, that a partner&#39;s use of the platform is materially inconsistent with the certification, Neuron may revoke partner status with 30 days&#39; notice and adjust pricing to standard enterprise rates at the next renewal.</p>

    <p style=\"font-family:var(--body);font-weight:300;font-size:0.875rem;color:var(--t3);line-height:1.8\">To inquire about the Partner Program, contact enterprise@neurontechnologies.ai with subject line &#34;Aligned Partner.&#34;</p>
  </div>

" + section("15", "General Provisions",
    p("This Agreement, together with the Order Form and any addenda, constitutes the entire agreement between the parties with respect to its subject matter and supersedes all prior negotiations, representations, and agreements. Any amendment must be in writing and signed by authorized representatives of both parties.")
  + p("If any provision of this Agreement is found unenforceable, it will be modified to the minimum extent necessary to make it enforceable, and the remaining provisions will continue in full force. Failure to enforce any provision is not a waiver of the right to enforce it later.")
  + p("Neither party may assign this Agreement without the other&#39;s written consent, except that Neuron may assign to an acquirer of all or substantially all of its business or assets without consent, provided the acquirer assumes all obligations under this Agreement.")
  + p_last("Notices must be in writing and sent to enterprise@neurontechnologies.ai for Neuron, or to the email address specified in the Order Form for Customer. Notices are effective on the day of confirmed receipt.")
) + "

  <div style=\"margin-top:4rem;padding-top:2rem;border-top:1px solid var(--border);display:flex;gap:2rem;flex-wrap:wrap\">
    <a href=\"/\" style=\"font-family:var(--body);font-size:0.8125rem;color:var(--navy);text-decoration:none\">&larr; Home</a>
    <a href=\"/legal/terms\" style=\"font-family:var(--body);font-size:0.8125rem;color:var(--navy);text-decoration:none\">Consumer Terms &rarr;</a>
  </div>
</div>
"
}
