// FRCP RULES ENGINE — Complete Federal Rules of Civil Procedure Database
// Organized by Title (I–XI) with deadline-relevant rules highlighted

const FRCP_DATABASE = {
  titles: [
    { num: 'I', name: 'Scope of Rules', range: '1' },
    { num: 'II', name: 'Commencing an Action; Service', range: '3–6' },
    { num: 'III', name: 'Pleadings and Motions', range: '7–16' },
    { num: 'IV', name: 'Parties', range: '17–25' },
    { num: 'V', name: 'Disclosures and Discovery', range: '26–37' },
    { num: 'VI', name: 'Trials', range: '38–53' },
    { num: 'VII', name: 'Judgment', range: '54–63' },
    { num: 'VIII', name: 'Provisional and Final Remedies', range: '64–71' },
    { num: 'IX', name: 'Special Proceedings', range: '71.1' },
    { num: 'X', name: 'District Courts and Clerks', range: '77–80' },
    { num: 'XI', name: 'General Provisions', range: '81–86' },
  ],

  rules: [
    // ── TITLE I: SCOPE ──
    { id: 'R1', rule: 'Rule 1', title: 'Scope and Purpose', titleNum: 'I', summary: 'Rules govern civil actions in U.S. district courts. Construed to secure just, speedy, and inexpensive determination.', hasDeadline: false, category: 'general' },

    // ── TITLE II: COMMENCING; SERVICE ──
    { id: 'R3', rule: 'Rule 3', title: 'Commencing an Action', titleNum: 'II', summary: 'Civil action commenced by filing a complaint with the court.', hasDeadline: false, category: 'commencement', practiceNote: 'Filing date triggers statute of limitations tolling.' },
    { id: 'R4', rule: 'Rule 4', title: 'Summons', titleNum: 'II', summary: 'Clerk issues summons upon filing. Must be served with complaint.', hasDeadline: true, category: 'service',
      deadlines: [
        { sub: '(m)', desc: 'Service must be made within 90 days of filing complaint', days: 90, trigger: 'Complaint Filed', type: 'calendar', critical: true },
        { sub: '(d)', desc: 'Waiver of service — 30 days to return waiver (60 if foreign)', days: 30, trigger: 'Waiver Request Sent', type: 'calendar', critical: false },
      ],
      practiceNote: 'Failure to serve within 90 days → court must dismiss without prejudice or order service by specific date. Request waiver first to save costs and get extra response time.' },
    { id: 'R4.1', rule: 'Rule 4.1', title: 'Serving Other Process', titleNum: 'II', summary: 'Process other than summons under Rule 4 — subpoenas, orders to show cause.', hasDeadline: false, category: 'service' },
    { id: 'R5', rule: 'Rule 5', title: 'Serving and Filing Pleadings', titleNum: 'II', summary: 'Every pleading, discovery paper, motion must be served on all parties. Electronic filing required unless exempted.', hasDeadline: false, category: 'service',
      practiceNote: 'Service by electronic means = complete on transmission. Papers filed under seal require leave of court.' },
    { id: 'R5.1', rule: 'Rule 5.1', title: 'Constitutional Challenge', titleNum: 'II', summary: 'Party challenging constitutionality of statute must serve Attorney General.', hasDeadline: true, category: 'service',
      deadlines: [{ sub: '(a)', desc: 'AG must be served promptly after constitutional question raised', days: 0, trigger: 'Constitutional Challenge Filed', type: 'immediate', critical: true }] },
    { id: 'R6', rule: 'Rule 6', title: 'Computing and Extending Time', titleNum: 'II', summary: 'Master rule for deadline calculation. Excludes day of trigger, includes last day. Extends to next business day if last day is weekend/holiday.', hasDeadline: true, category: 'deadlines',
      deadlines: [
        { sub: '(a)(1)', desc: 'Exclude day of event that triggers period', days: 0, trigger: 'Any', type: 'calculation', critical: true },
        { sub: '(a)(1)(C)', desc: 'If last day is Saturday, Sunday, or legal holiday → extends to next business day', days: 0, trigger: 'Any', type: 'calculation', critical: true },
        { sub: '(a)(2)', desc: 'Periods under 7 days: exclude intermediate Saturdays, Sundays, legal holidays (pre-2009 only)', days: 0, trigger: 'Any', type: 'calculation', critical: false },
        { sub: '(d)', desc: 'Additional 3 days after service by mail, leaving with clerk, or e-service', days: 3, trigger: 'Service by Mail/Electronic', type: 'calendar', critical: true },
      ],
      practiceNote: 'Rule 6(d) adds 3 days ONLY when a deadline is triggered by service. Does NOT apply to court-ordered deadlines. This is one of the most commonly miscalculated rules.' },

    // ── TITLE III: PLEADINGS AND MOTIONS ──
    { id: 'R7', rule: 'Rule 7', title: 'Pleadings Allowed; Form of Motions', titleNum: 'III', summary: 'Defines allowed pleadings: complaint, answer, answer to counterclaim/crossclaim, third-party complaint/answer, reply (if ordered).', hasDeadline: false, category: 'pleadings' },
    { id: 'R7.1', rule: 'Rule 7.1', title: 'Disclosure Statement', titleNum: 'III', summary: 'Nongovernmental corporate party must file disclosure identifying parent corps and stockholders.', hasDeadline: true, category: 'pleadings',
      deadlines: [{ sub: '(a)', desc: 'Must file with first appearance, pleading, motion, response, or other request', days: 0, trigger: 'First Filing', type: 'immediate', critical: false }] },
    { id: 'R8', rule: 'Rule 8', title: 'General Rules of Pleading', titleNum: 'III', summary: 'Complaint must contain: short plain statement of jurisdiction, claim showing entitlement to relief, demand for relief.', hasDeadline: false, category: 'pleadings' },
    { id: 'R9', rule: 'Rule 9', title: 'Pleading Special Matters', titleNum: 'III', summary: 'Fraud/mistake must be pled with particularity. Conditions precedent may be pled generally.', hasDeadline: false, category: 'pleadings', practiceNote: 'Heightened pleading standard for fraud under 9(b) — must allege who, what, when, where, how.' },
    { id: 'R10', rule: 'Rule 10', title: 'Form of Pleadings', titleNum: 'III', summary: 'Caption required. Numbered paragraphs. Exhibits may be attached.', hasDeadline: false, category: 'pleadings' },
    { id: 'R11', rule: 'Rule 11', title: 'Signing; Sanctions', titleNum: 'III', summary: 'Attorney signature certifies factual/legal basis exists. Sanctions for frivolous filings.', hasDeadline: true, category: 'pleadings',
      deadlines: [{ sub: '(c)(2)', desc: 'Safe harbor: 21 days to withdraw challenged filing before sanctions motion filed', days: 21, trigger: 'Sanctions Motion Served', type: 'calendar', critical: true }],
      practiceNote: 'The 21-day safe harbor is mandatory — sanctions motion cannot be filed until 21 days after service on opposing party.' },
    { id: 'R12', rule: 'Rule 12', title: 'Defenses and Objections', titleNum: 'III', summary: 'Responsive pleading deadlines. Pre-answer motions (12(b)). Motion to dismiss standards.', hasDeadline: true, category: 'responsive',
      deadlines: [
        { sub: '(a)(1)(A)(i)', desc: 'Answer due 21 days after service of summons and complaint', days: 21, trigger: 'Service of Process', type: 'calendar', critical: true },
        { sub: '(a)(1)(A)(ii)', desc: 'If waiver of service: answer due 60 days after waiver request sent (90 if foreign)', days: 60, trigger: 'Waiver Request Sent', type: 'calendar', critical: true },
        { sub: '(a)(4)(A)', desc: 'After 12(b) motion denied: answer due 14 days after notice of court\'s action', days: 14, trigger: '12(b) Motion Denied', type: 'calendar', critical: true },
        { sub: '(e)', desc: 'Motion for more definite statement: must comply within 14 days of order', days: 14, trigger: 'Order on 12(e) Motion', type: 'calendar', critical: false },
        { sub: '(f)', desc: 'Motion to strike — filed before responding to pleading, or within 21 days if no response required', days: 21, trigger: 'Pleading Served', type: 'calendar', critical: false },
      ],
      practiceNote: '12(b)(6) motions to dismiss are the single most common pre-answer motion. Waiving service under Rule 4(d) grants 60 days instead of 21.' },
    { id: 'R13', rule: 'Rule 13', title: 'Counterclaim and Crossclaim', titleNum: 'III', summary: 'Compulsory counterclaims must be raised or waived. Permissive counterclaims allowed.', hasDeadline: false, category: 'pleadings', practiceNote: 'Failure to assert compulsory counterclaim = waiver. Critical to identify early.', crossRefs: ['R12', 'R15'] },
    { id: 'R14', rule: 'Rule 14', title: 'Third-Party Practice', titleNum: 'III', summary: 'Defendant may serve third-party complaint within 14 days of answer; thereafter requires leave.', hasDeadline: true, category: 'responsive',
      deadlines: [{ sub: '(a)(1)', desc: 'Third-party complaint: 14 days after serving original answer (without leave)', days: 14, trigger: 'Answer Filed', type: 'calendar', critical: false }] },
    { id: 'R15', rule: 'Rule 15', title: 'Amended and Supplemental Pleadings', titleNum: 'III', summary: 'Amendment as of right within 21 days of serving, or 21 days after responsive pleading/12(b) motion.', hasDeadline: true, category: 'pleadings',
      deadlines: [
        { sub: '(a)(1)(A)', desc: 'Amend as of right: 21 days after serving original pleading', days: 21, trigger: 'Pleading Served', type: 'calendar', critical: true },
        { sub: '(a)(1)(B)', desc: 'Amend as of right: 21 days after responsive pleading or 12(b)/(e)/(f) motion served', days: 21, trigger: 'Responsive Pleading/Motion Served', type: 'calendar', critical: true },
      ],
      practiceNote: 'After the as-of-right period, amendment requires opposing party consent or court leave. Leave "freely given" under Rule 15(a)(2).' },
    { id: 'R16', rule: 'Rule 16', title: 'Pretrial Conferences; Scheduling', titleNum: 'III', summary: 'Court issues scheduling order. Sets deadlines for amendments, discovery, motions, trial. Pretrial conferences.', hasDeadline: true, category: 'case-management',
      deadlines: [
        { sub: '(b)(2)', desc: 'Scheduling order: issued after Rule 26(f) conference, within 90 days of service or 60 days of appearance', days: 90, trigger: 'Service of Process', type: 'calendar', critical: true },
      ],
      practiceNote: 'The scheduling order (CMO) is the master deadline document for every case. All other deadlines flow from it.', crossRefs: ['R26'] },

    // ── TITLE V: DISCLOSURES AND DISCOVERY ──
    { id: 'R26', rule: 'Rule 26', title: 'Duty to Disclose; General Discovery', titleNum: 'V', summary: 'Initial disclosures, expert disclosures, pretrial disclosures. Scope and limits of discovery. Protective orders.', hasDeadline: true, category: 'discovery',
      deadlines: [
        { sub: '(a)(1)(C)', desc: 'Initial disclosures: 14 days after Rule 26(f) conference', days: 14, trigger: 'Rule 26(f) Conference', type: 'calendar', critical: true },
        { sub: '(a)(2)(D)', desc: 'Expert disclosure: at least 90 days before trial', days: -90, trigger: 'Trial Date', type: 'before-trial', critical: true },
        { sub: '(a)(2)(D)(ii)', desc: 'Rebuttal expert: 30 days after initial expert disclosure', days: 30, trigger: 'Expert Disclosure Deadline', type: 'calendar', critical: true },
        { sub: '(a)(3)(B)', desc: 'Pretrial disclosures: at least 30 days before trial', days: -30, trigger: 'Trial Date', type: 'before-trial', critical: true },
        { sub: '(f)', desc: 'Parties must confer at least 21 days before scheduling conference', days: -21, trigger: 'Scheduling Conference', type: 'before-event', critical: true },
        { sub: '(f)(1)', desc: 'Discovery plan: submitted to court within 14 days of Rule 26(f) conference', days: 14, trigger: 'Rule 26(f) Conference', type: 'calendar', critical: false },
      ],
      practiceNote: 'Rule 26 is the backbone of discovery. Initial disclosures are automatic and mandatory — no request needed. Expert deadlines are among the most commonly missed.', crossRefs: ['R16', 'R33', 'R34', 'R36'] },
    { id: 'R27', rule: 'Rule 27', title: 'Depositions Before Action', titleNum: 'V', summary: 'Petition to perpetuate testimony before lawsuit filed.', hasDeadline: false, category: 'discovery' },
    { id: 'R28', rule: 'Rule 28', title: 'Persons Before Whom Depositions Taken', titleNum: 'V', summary: 'Depositions before officer authorized to administer oaths.', hasDeadline: false, category: 'discovery' },
    { id: 'R29', rule: 'Rule 29', title: 'Stipulations About Discovery', titleNum: 'V', summary: 'Parties may stipulate to modify discovery procedures unless court order prohibits.', hasDeadline: false, category: 'discovery' },
    { id: 'R30', rule: 'Rule 30', title: 'Depositions by Oral Examination', titleNum: 'V', summary: 'Oral depositions. Limit of 10 per side. 7 hours per deposition.', hasDeadline: true, category: 'deposition',
      deadlines: [
        { sub: '(a)(1)', desc: 'Deposition notice: reasonable written notice to every party', days: 14, trigger: 'Notice Served', type: 'reasonable', critical: false },
        { sub: '(a)(2)(A)(ii)', desc: 'Leave required if more than 10 depositions per side', days: 0, trigger: 'Deposition Limit Reached', type: 'leave', critical: false },
        { sub: '(d)(1)', desc: 'Deposition limited to 1 day of 7 hours', days: 0, trigger: 'Deposition Day', type: 'limit', critical: false },
        { sub: '(e)(1)', desc: 'Deponent has 30 days to review transcript after notice of availability', days: 30, trigger: 'Transcript Available', type: 'calendar', critical: false },
      ],
      practiceNote: 'Notice period is "reasonable" — courts generally accept 14 days. The 7-hour limit is strictly enforced; plan examination carefully. Consider FRCP 30(b)(6) for corporate deponents.', crossRefs: ['R26', 'R45'] },
    { id: 'R31', rule: 'Rule 31', title: 'Depositions by Written Questions', titleNum: 'V', summary: 'Written deposition questions served on parties. Cross-questions within 14 days.', hasDeadline: true, category: 'deposition',
      deadlines: [
        { sub: '(a)(4)', desc: 'Cross-questions: 14 days after direct questions served', days: 14, trigger: 'Direct Questions Served', type: 'calendar', critical: false },
        { sub: '(a)(5)', desc: 'Redirect questions: 7 days after cross-questions served', days: 7, trigger: 'Cross-Questions Served', type: 'calendar', critical: false },
      ] },
    { id: 'R33', rule: 'Rule 33', title: 'Interrogatories to Parties', titleNum: 'V', summary: 'Written questions. Limit 25 (including subparts). Responses under oath.', hasDeadline: true, category: 'discovery',
      deadlines: [
        { sub: '(b)(2)', desc: 'Interrogatory responses due 30 days after service', days: 30, trigger: 'Interrogatories Served', type: 'calendar', critical: true },
      ],
      practiceNote: 'Must answer under oath. Objections must be stated with specificity. 25-interrogatory limit includes discrete subparts.' },
    { id: 'R34', rule: 'Rule 34', title: 'Producing Documents', titleNum: 'V', summary: 'Requests for production of documents, ESI, tangible things, or land inspection.', hasDeadline: true, category: 'discovery',
      deadlines: [
        { sub: '(b)(2)(A)', desc: 'Production responses due 30 days after service', days: 30, trigger: 'RFP Served', type: 'calendar', critical: true },
        { sub: '(b)(2)(B)', desc: 'Early Rule 34 requests: responses due 30 days after parties\' first Rule 26(f) conference', days: 30, trigger: 'Rule 26(f) Conference', type: 'calendar', critical: false },
      ],
      practiceNote: 'ESI is the biggest cost driver. Negotiate format and scope early. "Reasonably accessible" standard applies. Proportionality factors under Rule 26(b)(1) limit scope.', crossRefs: ['R26', 'R37', 'R45'] },
    { id: 'R36', rule: 'Rule 36', title: 'Requests for Admission', titleNum: 'V', summary: 'Requests to admit facts or document authenticity. Deemed admitted if no response.', hasDeadline: true, category: 'discovery',
      deadlines: [
        { sub: '(a)(3)', desc: 'RFA responses due 30 days after service — DEEMED ADMITTED if no response', days: 30, trigger: 'RFA Served', type: 'calendar', critical: true },
      ],
      practiceNote: 'THIS IS THE MOST DANGEROUS DISCOVERY DEADLINE. Failure to respond = automatic admission. Calendar immediately upon receipt. Withdrawal requires court leave under Rule 36(b).', crossRefs: ['R26', 'R37'] },
    { id: 'R35', rule: 'Rule 35', title: 'Physical and Mental Examinations', titleNum: 'V', summary: 'Court may order physical/mental examination of party whose condition is in controversy. Requires good cause and in-controversy showing.', hasDeadline: true, category: 'discovery',
      deadlines: [
        { sub: '(b)(1)', desc: 'Examined party may request copy of report; examiner must provide within 30 days', days: 30, trigger: 'Report Requested', type: 'calendar', critical: false },
      ],
      practiceNote: 'Only available by court order or stipulation. Party requesting exam must show condition is "in controversy" and "good cause" exists. Requesting report waives privilege for own exams of same condition.',
      crossRefs: ['R26', 'R37'] },
    { id: 'R37', rule: 'Rule 37', title: 'Failure to Make Disclosures or Cooperate; Sanctions', titleNum: 'V', summary: 'Sanctions for discovery failures. Motion to compel. Meet-and-confer requirement. ESI spoliation sanctions under 37(e).', hasDeadline: true, category: 'discovery',
      deadlines: [
        { sub: '(a)(1)', desc: 'Motion to compel: must include certification of good-faith meet-and-confer', days: 0, trigger: 'Discovery Dispute', type: 'prerequisite', critical: true },
        { sub: '(e)', desc: 'ESI spoliation: court may order measures no greater than necessary to cure prejudice; intent to deprive required for adverse inference', days: 0, trigger: 'ESI Lost/Destroyed', type: 'prerequisite', critical: true },
      ],
      practiceNote: 'Rule 37(e) is the ESI spoliation rule (amended 2015). Two tiers: (1) measures to cure prejudice (no intent needed), (2) adverse inference/dismissal (intent to deprive required). Issue litigation hold letters IMMEDIATELY upon anticipation of litigation.',
      crossRefs: ['R26', 'R34'] },

    // ── DISMISSAL / SUBPOENAS ──
    { id: 'R41', rule: 'Rule 41', title: 'Dismissal of Actions', titleNum: 'VI', summary: 'Voluntary dismissal by plaintiff (as of right before answer/MSJ). Involuntary dismissal by court. Two-dismissal rule bars refiling.', hasDeadline: true, category: 'judgment',
      deadlines: [
        { sub: '(a)(1)(A)(i)', desc: 'Voluntary dismissal as of right: before opposing party serves answer or MSJ', days: 0, trigger: 'Answer/MSJ Filed', type: 'prerequisite', critical: true },
      ],
      practiceNote: 'Two-dismissal rule (41(a)(1)(B)): second voluntary dismissal of same claim = adjudication on merits. Critical trap for serial filers.',
      crossRefs: ['R12', 'R56'] },
    { id: 'R45', rule: 'Rule 45', title: 'Subpoena', titleNum: 'VI', summary: 'Subpoenas for testimony, documents, ESI, or inspection. 100-mile rule limits compliance geography. Must tender witness fees.', hasDeadline: true, category: 'discovery',
      deadlines: [
        { sub: '(d)(2)(B)', desc: 'Objection to subpoena: written objections within 14 days of service', days: 14, trigger: 'Subpoena Served', type: 'calendar', critical: true },
        { sub: '(d)(3)', desc: 'Motion to quash or modify: filed before compliance date', days: 0, trigger: 'Subpoena Compliance Date', type: 'before-event', critical: true },
      ],
      practiceNote: 'Non-parties must be subpoenaed — no obligation to comply otherwise. Always serve with witness fees and mileage. 100-mile rule limits compelled appearance geography.',
      crossRefs: ['R30', 'R34'] },
    { id: 'R52', rule: 'Rule 52', title: 'Findings and Conclusions by the Court', titleNum: 'VI', summary: 'In bench trials, court must find facts specially and state conclusions of law. Motion to amend findings available.', hasDeadline: true, category: 'trial',
      deadlines: [
        { sub: '(b)', desc: 'Motion to amend findings: within 28 days after entry of judgment', days: 28, trigger: 'Judgment Entered', type: 'calendar', critical: true },
      ],
      practiceNote: 'Findings of fact reviewed for clear error on appeal (highly deferential). Propose detailed findings before judgment.',
      crossRefs: ['R59', 'R50'] },

    // ── TITLE VI: TRIALS ──
    { id: 'R38', rule: 'Rule 38', title: 'Right to Jury Trial; Demand', titleNum: 'VI', summary: 'Jury trial demand must be served within 14 days after last pleading on the issue.', hasDeadline: true, category: 'trial',
      deadlines: [
        { sub: '(b)', desc: 'Jury demand: within 14 days after service of last pleading on the issue', days: 14, trigger: 'Last Pleading Served', type: 'calendar', critical: true },
      ],
      practiceNote: 'FAILURE TO DEMAND = WAIVER of jury right. Best practice: include jury demand in complaint/answer.', crossRefs: ['R12', 'R51'] },
    { id: 'R50', rule: 'Rule 50', title: 'Judgment as a Matter of Law', titleNum: 'VI', summary: 'JMOL motion. Renewed JMOL (RJMOL) after verdict.', hasDeadline: true, category: 'trial',
      deadlines: [
        { sub: '(b)', desc: 'Renewed JMOL: within 28 days after entry of judgment', days: 28, trigger: 'Judgment Entered', type: 'calendar', critical: true },
        { sub: '(d)', desc: 'Conditional ruling on new trial motion with RJMOL', days: 28, trigger: 'Judgment Entered', type: 'calendar', critical: false },
      ] },
    { id: 'R51', rule: 'Rule 51', title: 'Instructions to the Jury', titleNum: 'VI', summary: 'Proposed jury instructions. Objections at close of evidence or as court orders.', hasDeadline: true, category: 'trial',
      deadlines: [
        { sub: '(a)(1)', desc: 'Proposed instructions: at close of evidence or earlier as court orders', days: 0, trigger: 'Court Order / Close of Evidence', type: 'court-set', critical: true },
      ] },

    // ── TITLE VII: JUDGMENT ──
    { id: 'R54', rule: 'Rule 54', title: 'Judgment; Costs', titleNum: 'VII', summary: 'Judgment on multiple claims or parties. Costs to prevailing party.', hasDeadline: true, category: 'judgment',
      deadlines: [
        { sub: '(d)(2)(B)', desc: 'Motion for attorney fees: within 14 days after entry of judgment', days: 14, trigger: 'Judgment Entered', type: 'calendar', critical: true },
      ] },
    { id: 'R55', rule: 'Rule 55', title: 'Default; Default Judgment', titleNum: 'VII', summary: 'Entry of default when party fails to plead or defend.', hasDeadline: false, category: 'judgment',
      practiceNote: 'Default can be set aside for "good cause" under 55(c). Default judgment requires proving damages.' },
    { id: 'R56', rule: 'Rule 56', title: 'Summary Judgment', titleNum: 'VII', summary: 'Motion for summary judgment. No genuine dispute of material fact.', hasDeadline: true, category: 'motion',
      deadlines: [
        { sub: '(b)', desc: 'MSJ: may file at any time until 30 days after close of discovery (unless local rule sets different)', days: 30, trigger: 'Discovery Cutoff', type: 'calendar', critical: true },
        { sub: '(c)(1)(A)', desc: 'Opposition papers: timing set by local rule or court order (typically 21 days)', days: 21, trigger: 'MSJ Served', type: 'calendar', critical: true },
      ],
      practiceNote: 'Summary judgment is the most important dispositive motion. Local rules vary significantly — always check. Celotex/Anderson/Matsushita trilogy governs the standard.', crossRefs: ['R12', 'R56'] },
    { id: 'R59', rule: 'Rule 59', title: 'New Trial; Altering Judgment', titleNum: 'VII', summary: 'Motion for new trial. Motion to alter or amend judgment.', hasDeadline: true, category: 'post-trial',
      deadlines: [
        { sub: '(b)', desc: 'Motion for new trial: within 28 days after entry of judgment', days: 28, trigger: 'Judgment Entered', type: 'calendar', critical: true },
        { sub: '(e)', desc: 'Motion to alter/amend judgment: within 28 days after entry', days: 28, trigger: 'Judgment Entered', type: 'calendar', critical: true },
      ] },
    { id: 'R60', rule: 'Rule 60', title: 'Relief from Judgment', titleNum: 'VII', summary: 'Motion for relief from final judgment. Clerical mistakes, excusable neglect, fraud.', hasDeadline: true, category: 'post-trial',
      deadlines: [
        { sub: '(b)', desc: 'Motion under 60(b)(1)-(3): within reasonable time, max 1 year after judgment', days: 365, trigger: 'Judgment Entered', type: 'calendar', critical: true },
        { sub: '(c)(1)', desc: 'Motion under 60(b): within reasonable time', days: 0, trigger: 'Judgment Entered', type: 'reasonable', critical: false },
      ] },
    { id: 'R62', rule: 'Rule 62', title: 'Stay of Proceedings', titleNum: 'VII', summary: 'Automatic stay of execution for 30 days after judgment. Supersedeas bond.', hasDeadline: true, category: 'post-trial',
      deadlines: [
        { sub: '(a)', desc: 'Execution stayed automatically for 30 days after judgment entry', days: 30, trigger: 'Judgment Entered', type: 'automatic', critical: false },
      ] },

    // ── TITLE VIII: REMEDIES ──
    { id: 'R65', rule: 'Rule 65', title: 'Injunctions and Restraining Orders', titleNum: 'VIII', summary: 'TRO and preliminary injunction standards. TRO expires in 14 days.', hasDeadline: true, category: 'remedies',
      deadlines: [
        { sub: '(b)(2)', desc: 'TRO expires in 14 days (extendable for good cause up to 14 more)', days: 14, trigger: 'TRO Entered', type: 'calendar', critical: true },
      ],
      practiceNote: 'TRO may be granted ex parte if irreparable harm shown. Preliminary injunction requires notice and hearing. Four-factor test: likelihood of success, irreparable harm, balance of equities, public interest.',
      crossRefs: ['R52'] },

    // ── APPELLATE ──
    { id: 'FRAP4', rule: 'FRAP 4(a)', title: 'Appeal as of Right — When Taken', titleNum: 'VII', summary: 'Notice of appeal: 30 days after judgment (60 if US is party). JURISDICTIONAL — cannot be extended.', hasDeadline: true, category: 'post-trial',
      deadlines: [
        { sub: '(a)(1)(A)', desc: 'Notice of appeal: 30 days after judgment entry (civil)', days: 30, trigger: 'Judgment Entered', type: 'calendar', critical: true },
        { sub: '(a)(1)(B)', desc: 'Notice of appeal: 60 days if United States is a party', days: 60, trigger: 'Judgment Entered', type: 'calendar', critical: true },
        { sub: '(a)(4)', desc: 'Appeal deadline resets if Rule 50(b), 52(b), or 59 motion filed within 28 days', days: 0, trigger: 'Post-Trial Motion Decided', type: 'calculation', critical: true },
      ],
      practiceNote: 'THE MOST CRITICAL DEADLINE IN LITIGATION. Jurisdictional — courts cannot extend it. #2 cause of legal malpractice claims. Always calendar immediately upon judgment entry.',
      crossRefs: ['R50', 'R59', 'R62'] },
    { id: 'R68', rule: 'Rule 68', title: 'Offer of Judgment', titleNum: 'VIII', summary: 'Defendant may offer judgment. If rejected and plaintiff recovers less → plaintiff pays post-offer costs.', hasDeadline: true, category: 'settlement',
      deadlines: [
        { sub: '(a)', desc: 'Offer must be served at least 14 days before trial', days: -14, trigger: 'Trial Date', type: 'before-trial', critical: false },
        { sub: '(a)', desc: 'Opposing party has 14 days to accept offer of judgment', days: 14, trigger: 'Offer Served', type: 'calendar', critical: true },
      ],
      practiceNote: 'Powerful tool for cost-shifting. If plaintiff rejects and does worse at trial, plaintiff pays all post-offer costs.', crossRefs: ['R54'] },
  ],
};

window.FRCP_DATABASE = FRCP_DATABASE;
