{
  "id": 124,
  "slug": "adaptive-bottom-tab-subnav",
  "name": "Adaptive Bottom-Tab + Contextual Sub-Nav Bar",
  "kind": "ui",
  "family": "Navigation & Docks",
  "sourceSite": {
    "name": "Monzo",
    "url": "https://monzo.com",
    "verifiedStatus": 200
  },
  "tagline": "Persistent 5-tab mobile bottom bar (left rail on desktop) paired with a contextual pill sub-nav that morphs per tab.",
  "whyUnique": "Organizes complex multi-section apps cleanly by separating global destination switching from per-section sub-views without ever resorting to nested hamburger drawers.",
  "theme": "light",
  "mobileStrength": "native-first",
  "tags": [
    "bottom-tabs",
    "contextual-subnav",
    "adaptive-nav",
    "fintech-app",
    "responsive-shell"
  ],
  "bestFor": [
    "Mobile banking & fintech apps",
    "Social & community platforms",
    "Health & fitness dashboards",
    "Multi-module SaaS apps"
  ],
  "palette": [
    {
      "role": "canvas",
      "hex": "#F4F6F9",
      "name": "Cloud Ledger"
    },
    {
      "role": "surface",
      "hex": "#FFFFFF",
      "name": "Card White"
    },
    {
      "role": "ink",
      "hex": "#14233C",
      "name": "Deep Navy"
    },
    {
      "role": "accent",
      "hex": "#FF4D57",
      "name": "Hot Coral"
    },
    {
      "role": "muted",
      "hex": "#62728A",
      "name": "Harbor Slate"
    }
  ],
  "typography": {
    "display": "Plus Jakarta Sans",
    "body": "Inter",
    "mono": "JetBrains Mono",
    "googleFontsUrl": "https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=JetBrains+Mono:wght@600&family=Plus+Jakarta+Sans:wght@700;800&display=swap",
    "scaleNotes": "Crisp 11px bottom-tab labels, 13px contextual pill tabs, and tabular-nums monetary balances."
  },
  "layoutNotes": "Fixed 5-column bottom tab bar on mobile that transforms into a sticky 230px left navigation rail at >=900px, paired with a sticky top contextual pill sub-nav.",
  "interactionNotes": "Switching any primary tab dynamically swaps the contextual sub-nav pills and hero/list view with zero page reload, preserving clear active states in both navigation tiers.",
  "mobileNotes": "50px-tall bottom tabs with safe-area-inset-bottom support and horizontally scrollable contextual pills prevent crowding on 390px viewports.",
  "agentGuardrails": {
    "do": [
      "Keep primary bottom navigation strictly to 3-5 top-level destinations with icon + short label",
      "Transform the bottom tab bar into a left sidebar rail on desktop screens instead of stretching a bottom bar across 1280px",
      "Clearly distinguish the active primary tab and active contextual sub-pill with distinct visual hierarchy"
    ],
    "dont": [
      "Do not place 2 stacked bottom bars on mobile; keep primary tabs at the bottom and contextual sub-nav at the top",
      "Do not omit text labels on primary navigation tabs"
    ]
  },
  "demoFile": "demos/adaptive-bottom-tab-subnav.html",
  "thumbDesktop": "thumbs/adaptive-bottom-tab-subnav-desktop.webp",
  "thumbMobile": "thumbs/adaptive-bottom-tab-subnav-mobile.webp",
  "urls": {
    "page": "https://templates.michaelpitts.net/t/adaptive-bottom-tab-subnav",
    "markdown": "https://templates.michaelpitts.net/t/adaptive-bottom-tab-subnav.md",
    "api": "https://templates.michaelpitts.net/api/templates/adaptive-bottom-tab-subnav",
    "demo": "https://templates.michaelpitts.net/demos/adaptive-bottom-tab-subnav.html",
    "thumbDesktop": "https://templates.michaelpitts.net/thumbs/adaptive-bottom-tab-subnav-desktop.webp",
    "thumbMobile": "https://templates.michaelpitts.net/thumbs/adaptive-bottom-tab-subnav-mobile.webp"
  },
  "agentPrompt": "Design & build using template #124 \"Adaptive Bottom-Tab + Contextual Sub-Nav Bar\" (ui / Navigation & Docks, light theme).\nFull AI blueprint & standalone starter code: https://templates.michaelpitts.net/t/adaptive-bottom-tab-subnav.md\nLive demo: https://templates.michaelpitts.net/demos/adaptive-bottom-tab-subnav.html\nReal-world inspiration: Monzo (https://monzo.com)\n\nCore aesthetic: Organizes complex multi-section apps cleanly by separating global destination switching from per-section sub-views without ever resorting to nested hamburger drawers.\nPalette: canvas: #F4F6F9 (Cloud Ledger), surface: #FFFFFF (Card White), ink: #14233C (Deep Navy), accent: #FF4D57 (Hot Coral), muted: #62728A (Harbor Slate)\nTypography: Display=\"Plus Jakarta Sans\", Body=\"Inter\", Mono=\"JetBrains Mono\"\nLayout: Fixed 5-column bottom tab bar on mobile that transforms into a sticky 230px left navigation rail at >=900px, paired with a sticky top contextual pill sub-nav.\nInteractions: Switching any primary tab dynamically swaps the contextual sub-nav pills and hero/list view with zero page reload, preserving clear active states in both navigation tiers.\nMobile: 50px-tall bottom tabs with safe-area-inset-bottom support and horizontally scrollable contextual pills prevent crowding on 390px viewports.\n\nGuardrails:\n- DO: Keep primary bottom navigation strictly to 3-5 top-level destinations with icon + short label\n- DO: Transform the bottom tab bar into a left sidebar rail on desktop screens instead of stretching a bottom bar across 1280px\n- DO: Clearly distinguish the active primary tab and active contextual sub-pill with distinct visual hierarchy\n- DON'T: Do not place 2 stacked bottom bars on mobile; keep primary tabs at the bottom and contextual sub-nav at the top\n- DON'T: Do not omit text labels on primary navigation tabs",
  "sourceCode": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>Adaptive Bottom-Tab + Contextual Sub-Nav Bar</title>\n<style>\n  :root {\n    --canvas: #F4F6F9;\n    --surface: #FFFFFF;\n    --ink: #14233C;\n    --accent: #FF4D57;\n    --accent-soft: rgba(255, 77, 87, 0.12);\n    --muted: #62728A;\n    --border: #E2E7F0;\n    --radius: 16px;\n  }\n  * { box-sizing: border-box; margin: 0; padding: 0; }\n  html, body {\n    min-height: 100%;\n    background: var(--canvas);\n    color: var(--ink);\n    font-family: -apple-system, BlinkMacSystemFont, \"Inter\", \"Segoe UI\", Roboto, sans-serif;\n    -webkit-font-smoothing: antialiased;\n    overflow-x: hidden;\n  }\n  .app-frame {\n    min-height: 100dvh;\n    display: flex;\n    flex-direction: column;\n  }\n  @media (min-width: 900px) {\n    .app-frame {\n      flex-direction: row;\n    }\n  }\n\n  /* Adaptive Primary Nav: Bottom Tab Bar on Mobile, Left Rail on Desktop */\n  nav.primary-nav {\n    position: fixed;\n    left: 0;\n    right: 0;\n    bottom: 0;\n    z-index: 40;\n    background: rgba(255, 255, 255, 0.96);\n    backdrop-filter: blur(12px);\n    border-top: 1px solid var(--border);\n    display: grid;\n    grid-template-columns: repeat(5, 1fr);\n    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));\n    gap: 4px;\n  }\n  @media (min-width: 900px) {\n    nav.primary-nav {\n      position: sticky;\n      top: 0;\n      height: 100dvh;\n      width: 230px;\n      flex-shrink: 0;\n      border-top: none;\n      border-right: 1px solid var(--border);\n      display: flex;\n      flex-direction: column;\n      padding: 22px 14px;\n      gap: 6px;\n    }\n  }\n  .rail-brand {\n    display: none;\n  }\n  @media (min-width: 900px) {\n    .rail-brand {\n      display: flex;\n      align-items: center;\n      gap: 10px;\n      padding: 4px 10px 20px;\n      font-weight: 800;\n      font-size: 1.05rem;\n      letter-spacing: -0.02em;\n    }\n  }\n  .coral-mark {\n    width: 28px;\n    height: 28px;\n    border-radius: 8px;\n    background: var(--accent);\n    color: #fff;\n    display: grid;\n    place-items: center;\n    font-weight: 900;\n    font-size: 0.9rem;\n  }\n\n  .tab-btn {\n    min-height: 50px;\n    border: none;\n    background: transparent;\n    color: var(--muted);\n    border-radius: 12px;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    justify-content: center;\n    gap: 3px;\n    font-size: 0.68rem;\n    font-weight: 700;\n    cursor: pointer;\n    transition: background 0.16s, color 0.16s;\n  }\n  @media (min-width: 900px) {\n    .tab-btn {\n      flex-direction: row;\n      justify-content: flex-start;\n      padding: 0 14px;\n      gap: 12px;\n      font-size: 0.9rem;\n      min-height: 46px;\n    }\n  }\n  .tab-btn:hover { background: var(--canvas); color: var(--ink); }\n  .tab-btn.active {\n    color: var(--accent);\n    background: var(--accent-soft);\n  }\n  .tab-btn svg { width: 20px; height: 20px; flex-shrink: 0; }\n\n  /* Main content column */\n  .main-col {\n    flex: 1;\n    min-width: 0;\n    padding-bottom: 90px;\n  }\n  @media (min-width: 900px) {\n    .main-col { padding-bottom: 40px; }\n  }\n\n  .top-header {\n    background: var(--surface);\n    border-bottom: 1px solid var(--border);\n    padding: 16px 20px 12px;\n    position: sticky;\n    top: 0;\n    z-index: 20;\n  }\n  .header-row {\n    max-width: 920px;\n    margin: 0 auto;\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    gap: 12px;\n  }\n  .header-row h1 {\n    font-size: clamp(1.2rem, 3vw, 1.5rem);\n    letter-spacing: -0.02em;\n  }\n  .balance-pill {\n    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n    font-weight: 700;\n    font-size: 0.88rem;\n    padding: 6px 12px;\n    border-radius: 999px;\n    background: #14233C;\n    color: #fff;\n  }\n\n  /* Contextual Sub-Nav Pill Bar (morphs per active tab) */\n  .subnav-rail {\n    max-width: 920px;\n    margin: 12px auto 0;\n    display: flex;\n    gap: 8px;\n    overflow-x: auto;\n    scrollbar-width: none;\n    padding-bottom: 2px;\n  }\n  .subnav-rail::-webkit-scrollbar { display: none; }\n  .sub-pill {\n    min-height: 40px;\n    padding: 0 15px;\n    border-radius: 999px;\n    border: 1px solid var(--border);\n    background: var(--canvas);\n    color: var(--muted);\n    font-size: 0.83rem;\n    font-weight: 700;\n    white-space: nowrap;\n    cursor: pointer;\n    transition: background 0.16s, color 0.16s, border-color 0.16s;\n  }\n  .sub-pill:hover { border-color: #BCC6D6; color: var(--ink); }\n  .sub-pill.active {\n    background: var(--ink);\n    border-color: var(--ink);\n    color: #fff;\n  }\n\n  .content-wrap {\n    max-width: 920px;\n    margin: 0 auto;\n    padding: 20px 18px;\n    display: flex;\n    flex-direction: column;\n    gap: 16px;\n  }\n\n  .hero-card {\n    background: linear-gradient(135deg, #14233C 0%, #233B63 100%);\n    color: #fff;\n    border-radius: var(--radius);\n    padding: 20px;\n    display: flex;\n    flex-wrap: wrap;\n    align-items: center;\n    justify-content: space-between;\n    gap: 16px;\n  }\n  .hero-card small {\n    display: block;\n    font-size: 0.76rem;\n    opacity: 0.78;\n    text-transform: uppercase;\n    letter-spacing: 0.08em;\n  }\n  .hero-card .metric {\n    font-size: clamp(1.7rem, 4.5vw, 2.2rem);\n    font-weight: 800;\n    font-variant-numeric: tabular-nums;\n    letter-spacing: -0.03em;\n    margin-top: 2px;\n  }\n  .hero-cta {\n    min-height: 44px;\n    padding: 0 18px;\n    border-radius: 999px;\n    border: none;\n    background: var(--accent);\n    color: #fff;\n    font-weight: 700;\n    font-size: 0.86rem;\n    cursor: pointer;\n  }\n\n  .list-card {\n    background: var(--surface);\n    border: 1px solid var(--border);\n    border-radius: var(--radius);\n    overflow: hidden;\n  }\n  .list-item {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    gap: 12px;\n    padding: 15px 18px;\n    border-bottom: 1px solid var(--border);\n  }\n  .list-item:last-child { border-bottom: none; }\n  .item-left {\n    display: flex;\n    align-items: center;\n    gap: 12px;\n    min-width: 0;\n  }\n  .item-badge {\n    width: 40px;\n    height: 40px;\n    border-radius: 12px;\n    background: var(--canvas);\n    display: grid;\n    place-items: center;\n    font-weight: 800;\n    font-size: 0.85rem;\n    color: var(--ink);\n    flex-shrink: 0;\n  }\n  .item-info strong { display: block; font-size: 0.92rem; }\n  .item-info span { font-size: 0.78rem; color: var(--muted); }\n  .item-amount {\n    font-weight: 700;\n    font-size: 0.94rem;\n    font-variant-numeric: tabular-nums;\n    flex-shrink: 0;\n  }\n  .item-amount.pos { color: #059669; }\n</style>\n</head>\n<body>\n  <div class=\"app-frame\">\n    <nav class=\"primary-nav\" aria-label=\"Primary navigation\">\n      <div class=\"rail-brand\">\n        <span class=\"coral-mark\">K</span>\n        <span>Koral Bank</span>\n      </div>\n      <button class=\"tab-btn active\" data-tab=\"home\" type=\"button\">\n        <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M3 10.5L12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1v-9.5z\"/></svg>\n        <span>Home</span>\n      </button>\n      <button class=\"tab-btn\" data-tab=\"activity\" type=\"button\">\n        <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M4 6h16M4 12h16M4 18h10\"/></svg>\n        <span>Activity</span>\n      </button>\n      <button class=\"tab-btn\" data-tab=\"pots\" type=\"button\">\n        <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><circle cx=\"12\" cy=\"12\" r=\"8\"/><path d=\"M12 8v8M9 11h6\"/></svg>\n        <span>Pots</span>\n      </button>\n      <button class=\"tab-btn\" data-tab=\"payments\" type=\"button\">\n        <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M5 12h14M13 6l6 6-6 6\"/></svg>\n        <span>Pay</span>\n      </button>\n      <button class=\"tab-btn\" data-tab=\"cards\" type=\"button\">\n        <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 10h18\"/></svg>\n        <span>Cards</span>\n      </button>\n    </nav>\n\n    <div class=\"main-col\">\n      <header class=\"top-header\">\n        <div class=\"header-row\">\n          <h1 id=\"viewTitle\">Home</h1>\n          <div class=\"balance-pill\">£4,820.40</div>\n        </div>\n        <div id=\"subnavRail\" class=\"subnav-rail\" role=\"tablist\" aria-label=\"Contextual sub-navigation\"></div>\n      </header>\n\n      <main class=\"content-wrap\" id=\"contentWrap\"></main>\n    </div>\n  </div>\n\n<script>\n(() => {\n  const DATA = {\n    home: {\n      title: 'Home',\n      subtabs: ['Overview', 'Left to Spend', 'Upcoming Bills', 'Insights'],\n      views: {\n        'Overview': {\n          label: 'Current Account Balance', metric: '£4,820.40', cta: '+ Add Money',\n          rows: [\n            { icon: '☕', name: 'Monmouth Coffee Co.', sub: 'Today · 09:14 · Eating Out', amt: '-£4.60' },\n            { icon: '🚇', name: 'TfL Contactless', sub: 'Today · 08:32 · Transport', amt: '-£3.40' },\n            { icon: '💼', name: 'Northstar Design Ltd', sub: 'Yesterday · Salary Credit', amt: '+£3,450.00', pos: true },\n            { icon: '🛒', name: 'Waitrose & Partners', sub: 'Yesterday · Groceries', amt: '-£42.15' }\n          ]\n        },\n        'Left to Spend': {\n          label: 'Safe to Spend (14 days left)', metric: '£1,140.00', cta: 'Adjust Budget',\n          rows: [\n            { icon: '🥗', name: 'Groceries Budget', sub: '£185 of £320 used', amt: '£135 left' },\n            { icon: '🚆', name: 'Commute Budget', sub: '£64 of £110 used', amt: '£46 left' },\n            { icon: '🎬', name: 'Entertainment', sub: '£48 of £120 used', amt: '£72 left' }\n          ]\n        },\n        'Upcoming Bills': {\n          label: 'Scheduled in Next 7 Days', metric: '£942.00', cta: 'Pay Early',\n          rows: [\n            { icon: '🏠', name: 'Hackney Flat Rent', sub: 'Due in 3 days · Direct Debit', amt: '-£890.00' },\n            { icon: '⚡', name: 'Octopus Energy', sub: 'Due in 5 days · Standing Order', amt: '-£52.00' }\n          ]\n        },\n        'Insights': {\n          label: 'Monthly Savings Rate', metric: '28.4%', cta: 'Export CSV',\n          rows: [\n            { icon: '📉', name: 'Dining Down 14%', sub: 'Compared to last 30 days', amt: '+£68 saved', pos: true },\n            { icon: '🎯', name: 'Round-Ups Active', sub: '34 transactions rounded up', amt: '+£19.40', pos: true }\n          ]\n        }\n      }\n    },\n    activity: {\n      title: 'Activity',\n      subtabs: ['All', 'Card Spend', 'Transfers', 'Subscriptions'],\n      views: {\n        'All': {\n          label: '30-Day Outflow', metric: '£1,642.80', cta: 'Filter Feed',\n          rows: [\n            { icon: '☕', name: 'Monmouth Coffee Co.', sub: 'Card · Contactless', amt: '-£4.60' },\n            { icon: '📚', name: 'Daunt Books', sub: 'Card · Marylebone', amt: '-£24.99' },\n            { icon: '🎵', name: 'Spotify Duo', sub: 'Subscription · Monthly', amt: '-£14.99' }\n          ]\n        },\n        'Card Spend': {\n          label: 'Tap & Chip This Week', metric: '£186.25', cta: 'Freeze Card',\n          rows: [\n            { icon: '🥖', name: 'E5 Bakehouse', sub: 'Apple Pay · 11:05', amt: '-£8.40' },\n            { icon: '🚲', name: 'Lime Bike', sub: 'Contactless · 18:22', amt: '-£3.15' }\n          ]\n        },\n        'Transfers': {\n          label: 'Peer-to-Peer Splits', metric: '£215.00', cta: 'Split a Bill',\n          rows: [\n            { icon: '🍽️', name: 'Samir Patel', sub: 'Dinner split settled', amt: '+£38.50', pos: true },\n            { icon: '🎟️', name: 'Hannah Brooks', sub: 'Concert tickets', amt: '-£64.00' }\n          ]\n        },\n        'Subscriptions': {\n          label: 'Recurring Monthly', metric: '£71.97', cta: 'Manage',\n          rows: [\n            { icon: '🎵', name: 'Spotify Duo', sub: 'Renews 14th', amt: '-£14.99' },\n            { icon: '☁️', name: 'iCloud+ 2TB', sub: 'Renews 19th', amt: '-£8.99' },\n            { icon: '🏋️', name: 'Bouldering Club', sub: 'Renews 1st', amt: '-£47.99' }\n          ]\n        }\n      }\n    },\n    pots: {\n      title: 'Savings Pots',\n      subtabs: ['All Pots', 'Instant Access', 'Locked 4.8%'],\n      views: {\n        'All Pots': {\n          label: 'Total Across 3 Pots', metric: '£7,240.00', cta: '+ Create Pot',\n          rows: [\n            { icon: '✈️', name: 'Kyoto Autumn Trip', sub: 'Target £2,500 · 72% funded', amt: '£1,800.00', pos: true },\n            { icon: '🛡️', name: 'Emergency Buffer', sub: 'Instant Access · 4.1% AER', amt: '£4,200.00', pos: true },\n            { icon: '🧾', name: 'Tax Reserve', sub: 'Locked Pot · 4.8% AER', amt: '£1,240.00', pos: true }\n          ]\n        },\n        'Instant Access': {\n          label: 'Liquid Savings (4.1% AER)', metric: '£6,000.00', cta: 'Deposit Now',\n          rows: [\n            { icon: '🛡️', name: 'Emergency Buffer', sub: 'Withdraw anytime', amt: '£4,200.00', pos: true },\n            { icon: '✈️', name: 'Kyoto Autumn Trip', sub: 'Round-ups enabled', amt: '£1,800.00', pos: true }\n          ]\n        },\n        'Locked 4.8%': {\n          label: 'Fixed-Term Boost', metric: '£1,240.00', cta: 'View Maturity',\n          rows: [\n            { icon: '🧾', name: 'Tax Reserve', sub: 'Unlocks Jan 15 · +£59.52 est.', amt: '£1,240.00', pos: true }\n          ]\n        }\n      }\n    },\n    payments: {\n      title: 'Payments',\n      subtabs: ['Pay Someone', 'Request', 'Scheduled'],\n      views: {\n        'Pay Someone': {\n          label: 'Fastest Transfers (FPS)', metric: 'Zero Fees', cta: 'New Payee',\n          rows: [\n            { icon: 'SP', name: 'Samir Patel', sub: 'Last paid 2 days ago', amt: 'Send →' },\n            { icon: 'HB', name: 'Hannah Brooks', sub: 'Last paid last week', amt: 'Send →' }\n          ]\n        },\n        'Request': {\n          label: 'Open Payment Links', metric: '£38.50', cta: 'Create Link',\n          rows: [\n            { icon: '🔗', name: 'monzo.me/alex/18.50', sub: 'Waiting on 1 friend', amt: '£18.50' },\n            { icon: '🔗', name: 'monzo.me/alex/20.00', sub: 'Shared Airbnb groceries', amt: '£20.00' }\n          ]\n        },\n        'Scheduled': {\n          label: 'Automated Rules', metric: '2 Active', cta: '+ Schedule',\n          rows: [\n            { icon: '🏠', name: 'Rent Transfer', sub: '1st of every month', amt: '£890.00' },\n            { icon: '✈️', name: 'Kyoto Auto-Save', sub: 'Every Friday', amt: '£75.00' }\n          ]\n        }\n      }\n    },\n    cards: {\n      title: 'Cards',\n      subtabs: ['Physical Coral', 'Virtual Cards', 'Security'],\n      views: {\n        'Physical Coral': {\n          label: 'Hot Coral Debit · •• 4812', metric: 'Active', cta: 'Freeze Card',\n          rows: [\n            { icon: '💳', name: 'Contactless & Apple Pay', sub: 'Enabled worldwide · 0% FX fee', amt: 'On' },\n            { icon: '🏧', name: 'ATM Cash Allowance', sub: '£250 fee-free remaining', amt: '£250' }\n          ]\n        },\n        'Virtual Cards': {\n          label: 'Disposable & Pot-Linked', metric: '2 Cards', cta: '+ New Virtual',\n          rows: [\n            { icon: '🟣', name: 'Subscriptions Virtual', sub: 'Linked to Bills Pot · •• 9021', amt: 'Active' },\n            { icon: '🟢', name: 'Travel Booking Card', sub: 'Auto-expires in 12 days', amt: 'Active' }\n          ]\n        },\n        'Security': {\n          label: 'Card Protection Controls', metric: 'Protected', cta: 'View PIN',\n          rows: [\n            { icon: '🌍', name: 'Location-Based Security', sub: 'Matches phone GPS at checkout', amt: 'Enabled' },\n            { icon: '🔒', name: 'Magstripe ATM', sub: 'Disabled for safety', amt: 'Off' }\n          ]\n        }\n      }\n    }\n  };\n\n  let activeTab = 'home';\n  let activeSub = 'Overview';\n\n  const viewTitle = document.getElementById('viewTitle');\n  const subnavRail = document.getElementById('subnavRail');\n  const contentWrap = document.getElementById('contentWrap');\n  const tabBtns = [...document.querySelectorAll('.tab-btn')];\n\n  function renderSubnav() {\n    const cfg = DATA[activeTab];\n    subnavRail.innerHTML = '';\n    cfg.subtabs.forEach(sub => {\n      const btn = document.createElement('button');\n      btn.type = 'button';\n      btn.className = 'sub-pill' + (sub === activeSub ? ' active' : '');\n      btn.setAttribute('role', 'tab');\n      btn.setAttribute('aria-selected', String(sub === activeSub));\n      btn.textContent = sub;\n      btn.addEventListener('click', () => {\n        activeSub = sub;\n        renderSubnav();\n        renderContent();\n      });\n      subnavRail.appendChild(btn);\n    });\n  }\n\n  function renderContent() {\n    const cfg = DATA[activeTab];\n    const view = cfg.views[activeSub];\n    viewTitle.textContent = cfg.title;\n    contentWrap.innerHTML = `\n      <section class=\"hero-card\">\n        <div>\n          <small>${view.label}</small>\n          <div class=\"metric\">${view.metric}</div>\n        </div>\n        <button class=\"hero-cta\" type=\"button\">${view.cta}</button>\n      </section>\n      <section class=\"list-card\">\n        ${view.rows.map(r => `\n          <div class=\"list-item\">\n            <div class=\"item-left\">\n              <div class=\"item-badge\">${r.icon}</div>\n              <div class=\"item-info\">\n                <strong>${r.name}</strong>\n                <span>${r.sub}</span>\n              </div>\n            </div>\n            <div class=\"item-amount ${r.pos ? 'pos' : ''}\">${r.amt}</div>\n          </div>\n        `).join('')}\n      </section>\n    `;\n    const ctaBtn = contentWrap.querySelector('.hero-cta');\n    ctaBtn.addEventListener('click', () => {\n      const orig = ctaBtn.textContent;\n      ctaBtn.textContent = '✓ Action Opened';\n      setTimeout(() => { ctaBtn.textContent = orig; }, 1200);\n    });\n  }\n\n  tabBtns.forEach(btn => {\n    btn.addEventListener('click', () => {\n      activeTab = btn.dataset.tab;\n      activeSub = DATA[activeTab].subtabs[0];\n      tabBtns.forEach(b => b.classList.toggle('active', b === btn));\n      renderSubnav();\n      renderContent();\n    });\n  });\n\n  renderSubnav();\n  renderContent();\n})();\n</script>\n</body>\n</html>\n"
}
