body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    color: #334155;
  }
  
  .app {
    display: flex;
    height: 100vh;
    position: relative;
  }
  
  /* Mobile Menu Button */
  #menuToggle {
    display: none;
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 20;
    width: 40px;
    height: 40px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 0;
  }

  #menuToggle span {
    width: 20px;
    height: 2px;
    background-color: #334155;
    border-radius: 2px;
  }

/* Back to Hub Button */
  .back-to-hub-container {
    padding: 24px 24px 8px 24px; /* px-6 pt-6 pb-2 */
    margin-bottom: 0;
    border-bottom: none;
  }

  .back-to-hub-link {
    display: flex;
    align-items: center;
    gap: 8px; /* gap-2 */
    font-size: 11px; /* text-[11px] */
    font-weight: 700; /* font-bold */
    color: #94a3b8; /* text-slate-400 */
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.1em; /* tracking-widest */
    transition: color 0.2s; /* transition-colors */
  }

  .back-to-hub-link:hover {
    color: #4f46e5; /* hover:text-indigo-600 */
  }

  .back-to-hub-link svg {
    width: 12px; /* w-3 */
    height: 12px; /* h-3 */
    fill: none;
    stroke: currentColor;
    transition: transform 0.2s; /* transition-transform */
  }

  .back-to-hub-link:hover svg {
    transform: translateX(-4px); /* group-hover:-translate-x-1 */
  }

  /* Header Branding */
  .header-branding {
    padding: 8px 24px 24px 24px; /* px-6 pb-6 pt-2 */
    border-bottom: 1px solid #f1f5f9; /* border-b border-slate-100 */
    display: flex;
    align-items: center;
    gap: 12px; /* gap-3 */
  }

  .brand-icon {
    width: 40px; /* w-10 */
    height: 40px; /* h-10 */
    background-color: #4f46e5; /* bg-indigo-600 */
    border-radius: 12px; /* rounded-xl */
    box-shadow: 0 10px 15px -3px rgba(199, 210, 254, 0.5); /* shadow-lg shadow-indigo-200 */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white; /* text-white */
    font-size: 18px; /* text-lg */
    font-weight: 700; /* font-bold */
  }

  .brand-text h1 {
    font-weight: 700; /* font-bold */
    color: #0f172a; /* text-slate-900 */
    line-height: 1.25; /* leading-tight */
    font-size: 16px;
    margin: 0;
  }

  .brand-text p {
    font-size: 12px; /* text-xs */
    color: #64748b; /* text-slate-500 */
    font-weight: 500; /* font-medium */
    margin: 0;
  }

  .sidebar {
    width: 320px; /* w-72 (roughly) */
    overflow-y: auto;
    background: white; /* bg-white */
    border-right: 1px solid #e2e8f0; /* border-r border-slate-200 */
    padding: 0; /* padding reset handled by inner containers */
    flex-shrink: 0;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 20; /* z-20 */
  }

  /* Navigation Container (was #scenario-nav) */
  .nav-container {
    flex: 1; /* flex-1 */
    overflow-y: auto; /* overflow-y-auto */
    padding: 12px; /* p-3 */
  }

  .section {
    margin-bottom: 10px;
    border-bottom: none;
    padding-bottom: 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }


  .section:last-child {
    border-bottom: none;
  }
  
  .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px 12px;
    user-select: none;
    border-radius: 12px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
  }

  .section:hover .section-header {
    background-color: #f8fafc;
  }

  .section-heading-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .section-badge {
    display: inline-block;
    width: fit-content;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4f46e5;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 9999px;
    padding: 2px 8px;
  }

  .section h3,
  .section-title {
    margin: 0;
    font-size: 16px;
    text-transform: none;
    letter-spacing: 0;
    color: #334155;
    font-weight: 700;
    line-height: 1.2;
  }

  .accordion-icon {
    font-size: 16px;
    color: #94a3b8;
    transition: transform 0.2s ease;
    margin-left: 8px;
  }

  /* Accordion functionality */
  .file-list {
    display: none;
    margin-top: 0;
    padding: 0 8px 8px 8px;
  }

  .section.open .file-list {
    display: block;
  }

  .section.open .accordion-icon {
    transform: rotate(180deg);
  }

  .subheading {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    padding: 10px 8px 4px 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  /* Nested Accordion functionality */
  .sub-section {
    margin-bottom: 6px;
    border-radius: 8px;
    background: transparent;
    transition: all 0.2s ease;
  }

  .sub-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s ease;
  }

  .sub-section-header:hover {
    background-color: #f1f5f9;
  }

  .sub-section-header .subheading {
    padding: 6px 8px;
  }

  .sub-file-list {
    display: none;
    padding: 0 0 0 16px;
    margin-top: 4px;
    border-left: 1px solid #e2e8f0;
    margin-left: 8px;
  }

  .sub-section.open .sub-file-list {
    display: block;
  }

  .sub-section.open .sub-section-header .accordion-icon {
    transform: rotate(180deg);
  }
  
  .template-item {
    display: block;
    width: 100%;
    padding: 9px 10px;
    margin-bottom: 3px;
    text-align: left;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    cursor: pointer;
    border-radius: 8px;
    font-size: 13px;
    color: #475569;
    text-transform: capitalize;
    transition: all 0.2s ease;
  }
  
  .template-item:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
  }
  
  .template-item.active {
    background: #eef2ff;
    border-color: #a5b4fc;
    color: #3730a3;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.12);
  }
  
  .preview {
    flex: 1;
    background: #ffffff;
    display: flex;
    flex-direction: column; /* Changed to column to stack toolbar and iframe */
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: auto; /* Allow scanning through if content exceeds */
  }

  /* Toolbar Styles */
  .toolbar {
    margin-bottom: 20px;
    background: white;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 10;
  }

  .icon-btn {
    width: auto;
    padding: 6px 12px;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
  }

  .icon-btn:hover {
    background: #f1f5f9;
    color: #334155;
  }

  .icon-btn.active {
    background: #e2e8f0;
    color: #0f172a;
    font-weight: 600;
  }

  /* Iframe Container */
  .iframe-container {
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    overflow: hidden;
  }

  iframe {
    width: 100%;
    max-width: 800px; /* Desktop default */
    height: 100%;
    background: white;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    transition: max-width 0.3s ease, height 0.3s ease;
  }

  /* Mobile View State (iPhone 17 dimensions) */
  iframe.mobile-view {
    width: 393px;
    height: 852px;
    max-width: 393px;
    max-height: 852px;
    border-radius: 40px;
    border: 12px solid #334155;
    box-sizing: content-box; /* Ensures border doesn't eat into width */
    flex-shrink: 0;
  }

  @media (max-width: 768px) {
    /* ... existing mobile styles ... */
    #menuToggle {
      display: flex;
    }

    .sidebar {
      position: absolute;
      top: 0;
      left: 0;
      height: 100%;
      z-index: 10;
      transform: translateX(-100%);
      box-shadow: 4px 0 15px rgba(0,0,0,0.1);
    }

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

    .toolbar {
        display: none; /* Hide toolbar on actual mobile devices since width is already constrained */
    }
    
    .preview {
        padding: 20px 10px; /* Reduce padding on mobile */
        padding-top: 70px;
    }
    
    iframe {
        max-width: 100%; /* Force full width on mobile devices */
        border-radius: 4px;
    }
  }

  /* Comment Panel Styles */
  .comment-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 340px;
    max-height: 500px;
    background: white;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    z-index: 50;
    font-family: inherit;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .comment-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
  }

  .comment-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    background-color: #f8fafc;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }

  .comment-panel-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
  }

  .comment-panel-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    overflow-y: hidden;
  }

  .comments-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
  }
  
  .comments-list .no-comments {
    font-size: 13px;
    color: #94a3b8;
    text-align: center;
    font-style: italic;
    margin: 10px 0;
  }

  .comment-item {
    background: #f1f5f9;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: #334155;
    line-height: 1.4;
  }

  .comment-item .meta {
    display: block;
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    text-align: right;
  }

  .comment-input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .comment-input-area textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
  }

  .comment-input-area textarea:focus {
    border-color: #4f46e5;
  }

  .primary-btn {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
  }

  .primary-btn:hover {
    background: #4338ca;
  }

  .comment-panel-footer {
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
    background-color: #f8fafc;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
  }

  .secondary-btn {
    background: white;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
  }

  .secondary-btn:hover {
    background: #f1f5f9;
    color: #334155;
  }

  @media (max-width: 768px) {
    .comment-panel {
      width: calc(100% - 32px);
      right: 16px;
      bottom: 16px;
      max-height: 400px;
    }
  }
