/**
 * Template 2 — Patents & Intellectual Property Stylesheet
 * Modern scientific/academic styling matching Template 2 design system
 * Features:
 *  - Dark navy hero banner with intellectual property imagery & stat pills
 *  - Sticky left sidebar with nested Parent > Child category accordion
 *  - Full-width patent cards (NO THUMBNAILS as requested)
 *  - Rich status badges (Granted, Under Examination)
 *  - Live search & filter bar
 *  - Interactive Patent Details Modal
 *  - Fully responsive for mobile & tablet
 */

:root {
    --navy-darkest: #03142a;
    --navy-darker: #041a38;
    --navy-dark: #06234b;
    --navy-blue: #0a3164;
    --teal-bright: #00d2c4;
    --teal-primary: #0d9488;
    --teal-hover: #0f766e;
    --teal-light: #e6fffa;
    --teal-subtle: #f0fdfa;
    --teal-glow: rgba(0, 210, 196, 0.25);
    --blue-accent: #0284c7;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --text-dark: #0f294a;
    --text-body: #334155;
    --text-muted: #64748b;
    --border-light: rgba(226, 232, 240, 0.9);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 28px rgba(13, 148, 136, 0.12);
    --emerald-text: #059669;
    --emerald-bg: #ecfdf5;
    --emerald-border: #a7f3d0;
    --amber-text: #d97706;
    --amber-bg: #fffbeb;
    --amber-border: #fde68a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: clip;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    max-width: 100%;
}

.container {
    width: 100%;
    max-width: 1260px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   1. HERO BANNER
   ========================================================================== */
.pat-hero-banner {
    position: relative;
    min-height: 230px;
    background-color: var(--navy-dark);
    background-image: linear-gradient(to right, rgba(3, 20, 42, 0.94) 0%, rgba(6, 35, 75, 0.84) 52%, rgba(6, 35, 75, 0.35) 100%),
        url('../images/patents_banner.jpg');
    background-size: cover;
    background-position: center right;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    padding: 45px 0 55px;
    overflow: hidden;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.1);
}

.pat-hero-content {
    position: relative;
    z-index: 2;
    /*max-width: 760px; */
}

.pat-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
}

.pat-breadcrumb a {
    color: var(--teal-bright);
    text-decoration: none;
    transition: color 0.2s;
}

.pat-breadcrumb a:hover {
    text-decoration: underline;
}

.pat-hero-title {
    font-family: 'Outfit', 'Poppins', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.pat-hero-subtitle {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 22px;
    font-weight: 300;
}

.pat-stats-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.pat-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 6px 16px;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s, transform 0.2s;
}

.pat-stat-pill:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.pat-stat-pill i {
    color: var(--teal-bright);
    font-size: 0.95rem;
}

.pat-stat-pill strong {
    color: var(--teal-bright);
    font-weight: 700;
}

/* ==========================================================================
   2. MAIN LAYOUT (Sticky Sidebar + Right Content)
   ========================================================================== */
.pat-main-section {
    padding: 40px 0 80px;
}

.pat-layout-grid {
    display: grid;
    grid-template-columns: 290px 1fr;
    gap: 32px;
    align-items: start;
}

/* ==========================================================================
   3. LEFT SIDEBAR (STICKY TABS ACCORDION)
   ========================================================================== */
.pat-sidebar-wrapper {
    position: sticky;
    top: 90px;
    transition: transform 0.25s ease-out;
    z-index: 20;
}

.pat-sidebar-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.pat-sidebar-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pat-sidebar-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.pat-sidebar-nav {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Tab Item Base */
.pat-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text-dark);
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    user-select: none;
}

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

.pat-nav-item.active {
    background: var(--teal-light);
    color: var(--teal-hover);
    border-color: rgba(13, 148, 136, 0.25);
    font-weight: 600;
}

.pat-nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.pat-nav-icon {
    width: 20px;
    text-align: center;
    color: var(--teal-primary);
    font-size: 1rem;
    flex-shrink: 0;
}

.pat-nav-item.active .pat-nav-icon {
    color: var(--teal-hover);
}

.pat-nav-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pat-nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pat-nav-badge {
    background: #e2e8f0;
    color: #475569;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    min-width: 24px;
    text-align: center;
    transition: all 0.2s;
}

.pat-nav-item.active .pat-nav-badge {
    background: var(--teal-primary);
    color: #ffffff;
}

.pat-nav-toggle {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: transform 0.25s ease;
    padding: 2px 4px;
}

.pat-group.expanded .pat-nav-toggle {
    transform: rotate(180deg);
}

/* Parent Category Group with Children */
.pat-group {
    display: flex;
    flex-direction: column;
}

.pat-subnav {
    display: none;
    flex-direction: column;
    padding: 4px 0 6px 36px;
    gap: 4px;
    position: relative;
}

.pat-group.expanded .pat-subnav {
    display: flex;
}

.pat-subnav::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: #e2e8f0;
    border-radius: 2px;
}

.pat-subnav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-body);
    font-size: 0.86rem;
    text-decoration: none;
    cursor: pointer;
    background: transparent;
    transition: all 0.2s;
    position: relative;
}

.pat-subnav-item::before {
    content: '•';
    position: absolute;
    left: -16px;
    color: #94a3b8;
    font-size: 1.1rem;
    line-height: 1;
}

.pat-subnav-item:hover {
    background: #f8fafc;
    color: var(--teal-primary);
}

.pat-subnav-item.active {
    background: var(--teal-light);
    color: var(--teal-hover);
    font-weight: 600;
}

.pat-subnav-item.active::before {
    color: var(--teal-primary);
}

.pat-subnav-badge {
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
}

.pat-subnav-item.active .pat-subnav-badge {
    background: #ffffff;
    color: var(--teal-hover);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   4. RIGHT CONTENT AREA
   ========================================================================== */
.pat-content-area {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Top Bar: Title & Live Search */
.pat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    background: #ffffff;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.pat-topbar-info h2 {
    font-family: 'Outfit', 'Poppins', sans-serif;
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.25;
}

.pat-topbar-info p {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.pat-search-box {
    position: relative;
    width: 380px;
    max-width: 100%;
}

.pat-search-box i.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
}

.pat-search-input {
    width: 100%;
    height: 44px;
    padding: 0 42px 0 42px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-dark);
    transition: all 0.2s ease;
    outline: none;
}

.pat-search-input:focus {
    border-color: var(--teal-primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.pat-search-clear {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px;
    display: none;
}

.pat-search-clear:hover {
    color: #ef4444;
}

/* ==========================================================================
   5. CATEGORY & SUBCATEGORY SECTIONS
   ========================================================================== */
.pat-category-section {
    margin-bottom: 24px;
}

.pat-category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.pat-category-header h3 {
    font-family: 'Outfit', 'Poppins', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.pat-category-header .badge {
    background: #e2e8f0;
    color: var(--text-dark);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
}

.pat-subcategory-section {
    margin-bottom: 24px;
}

.pat-subcategory-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-left: 2px;
}

.pat-subcategory-header h4 {
    font-size: 1.08rem;
    font-weight: 600;
    color: var(--navy-blue);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pat-subcategory-header .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--teal-primary);
}

.pat-subcategory-header .badge {
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
}

/* ==========================================================================
   6. PATENT CARDS (STRICTLY NO THUMBNAIL)
   ========================================================================== */
.pat-cards-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pat-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    padding: 14px 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.pat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(13, 148, 136, 0.35);
}

/* Card Top: Title & Status Badge */
.pat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 0;
}

.pat-card-title {
    font-family: 'Outfit', 'Poppins', sans-serif;
    font-size: 1.08rem;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.35;
    transition: color 0.2s;
    text-decoration: none;
    flex: 1;
    margin: 0;
}

.pat-card-title:hover {
    color: var(--teal-primary);
}

/* Status Badges */
.pat-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.pat-status-pill.granted {
    color: var(--emerald-text);
    background: var(--emerald-bg);
    border: 1px solid var(--emerald-border);
}

.pat-status-pill.pending,
.pat-status-pill.examination {
    color: var(--amber-text);
    background: var(--amber-bg);
    border: 1px solid var(--amber-border);
}

/* Authors Row */
.pat-card-inventors {
    font-size: 0.88rem;
    color: #475569;
    line-height: 1.4;
    margin: 0;
}

.pat-inventor-author {
    color: var(--navy-blue);
    font-weight: 600;
}

/* Details / Snippet */
.pat-card-details {
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0;
}

.pat-card-details p {
    margin: 0;
}

/* Meta Row & Action Links (Inline in the directed place) */
.pat-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px 18px;
    flex-wrap: wrap;
    padding-top: 8px;
    margin-top: 2px;
    border-top: 1px solid #f1f5f9;
}

.pat-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.pat-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.pat-meta-item i {
    color: var(--teal-primary);
    font-size: 0.85rem;
}

.pat-meta-pill {
    background: #f1f5f9;
    color: var(--text-dark);
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
}

/* Action Links (Inline instead of bulky buttons) */
.pat-card-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.pat-action-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--teal-primary);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pat-action-link:hover {
    color: var(--teal-hover);
    background: rgba(13, 148, 136, 0.08);
}

.pat-action-link.pdf-link {
    color: #dc2626;
}

.pat-action-link.pdf-link:hover {
    color: #b91c1c;
    background: rgba(220, 38, 38, 0.08);
}

.pat-action-link.online-link {
    color: var(--blue-accent);
}

.pat-action-link.online-link:hover {
    color: #0284c7;
    background: rgba(2, 132, 199, 0.08);
}

/* Buttons (For Modal & General Use) */
.pat-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pat-btn-outline {
    background: #ffffff;
    color: var(--teal-hover);
    border: 1.5px solid var(--teal-primary);
}

.pat-btn-outline:hover {
    background: var(--teal-primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}

.pat-btn-subtle {
    background: #f1f5f9;
    color: var(--navy-blue);
    border: 1.5px solid #cbd5e1;
}

.pat-btn-subtle:hover {
    background: var(--navy-blue);
    color: #ffffff;
    border-color: var(--navy-blue);
}

.pat-btn-link {
    background: transparent;
    color: var(--teal-primary);
    padding: 6px 10px;
}

.pat-btn-link:hover {
    color: var(--teal-hover);
    text-decoration: underline;
}

/* Empty / No Results State */
.pat-no-results {
    text-align: center;
    padding: 60px 20px;
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px dashed #cbd5e1;
    display: none;
}

.pat-no-results.visible {
    display: block;
}

.pat-no-results-icon {
    font-size: 3rem;
    color: #94a3b8;
    margin-bottom: 16px;
}

.pat-no-results h3 {
    font-size: 1.25rem;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.pat-no-results p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 18px;
}

/* Hidden Utility */
.is-hidden {
    display: none !important;
}

/* ==========================================================================
   7. INTERACTIVE PATENT DETAILS MODAL
   ========================================================================== */
.pat-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(3, 20, 42, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.pat-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.pat-modal-dialog {
    background: #ffffff;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pat-modal-overlay.open .pat-modal-dialog {
    transform: translateY(0) scale(1);
}

.pat-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #f8fafc;
}

.pat-modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
}

.pat-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.pat-modal-close:hover {
    background: #e2e8f0;
    color: #ef4444;
}

.pat-modal-body {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.pat-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.35;
}

.pat-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    background: #f8fafc;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid #e2e8f0;
}

.pat-modal-grid-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pat-modal-grid-item span.label {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.pat-modal-grid-item span.value {
    font-size: 0.9rem;
    color: var(--text-dark);
    font-weight: 600;
}

.pat-modal-section-title {
    font-size: 0.88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.pat-modal-citation-box {
    background: #f1f5f9;
    padding: 14px;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--teal-primary);
    font-size: 0.88rem;
    color: var(--text-body);
    line-height: 1.6;
}

.pat-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* Toast Notification */
.pat-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--navy-darkest);
    color: #ffffff;
    padding: 12px 22px;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
}

.pat-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.pat-toast i {
    color: var(--teal-bright);
}

/* ==========================================================================
   8. RESPONSIVE DESIGN
   ========================================================================== */

/* ── Tablet & below (≤ 992px): sidebar collapses into a horizontal chip strip ── */
@media (max-width: 992px) {
    .pat-layout-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .pat-sidebar-wrapper {
        position: static;
        transform: none !important;
    }

    /* Sidebar card becomes a compact filter panel */
    .pat-sidebar-card {
        border-radius: var(--radius-md);
        overflow: visible;
    }

    .pat-sidebar-header {
        padding: 12px 16px 10px;
    }

    /* ── Scrollable chip strip for parent categories ── */
    .pat-sidebar-nav {
        flex-direction: column;
        padding: 10px 12px;
        gap: 0;
        overflow: visible;
    }

    /* Each group becomes a block inside the nav */
    .pat-group {
        flex-shrink: unset;
        width: 100%;
    }

    /* Parent tab buttons: full-width horizontal layout */
    .pat-nav-item {
        white-space: normal;
        width: 100%;
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    /* ── Subcategories: shown as a horizontal scrollable row ── */
    .pat-subnav {
        display: flex !important;           /* override the none from desktop */
        flex-direction: row !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 6px 4px 10px 8px !important;
        gap: 6px !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;              /* Firefox */
        -ms-overflow-style: none;           /* IE */
    }

    .pat-subnav::-webkit-scrollbar {
        display: none;                      /* Chrome / Safari */
    }

    /* Hide the left vertical rule on mobile */
    .pat-subnav::before {
        display: none;
    }

    /* Subcategory chips */
    .pat-subnav-item {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        flex-shrink: 0;
        white-space: nowrap;
        padding: 5px 12px;
        border-radius: 999px;
        font-size: 0.8rem;
        font-weight: 500;
        background: #f1f5f9;
        border: 1px solid #e2e8f0;
        color: var(--text-body);
        cursor: pointer;
        transition: all 0.2s;
        position: relative;
    }

    /* Remove the bullet pseudo-element on chips */
    .pat-subnav-item::before {
        display: none;
    }

    .pat-subnav-item:hover {
        background: var(--teal-subtle);
        border-color: var(--teal-primary);
        color: var(--teal-primary);
    }

    .pat-subnav-item.active {
        background: var(--teal-primary);
        border-color: var(--teal-primary);
        color: #ffffff;
        font-weight: 600;
    }

    .pat-subnav-item.active .pat-subnav-badge {
        background: rgba(255,255,255,0.25);
        color: #ffffff;
        box-shadow: none;
    }

    /* Hide subnav when its parent group is not expanded */
    .pat-group:not(.expanded) .pat-subnav {
        display: none !important;
    }

    /* Topbar: stack vertically */
    .pat-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 16px;
    }

    .pat-search-box {
        width: 100%;
    }

    /* Hero layout */
    .pat-hero-banner {
        padding: 32px 0 42px;
    }

    .pat-stats-pills {
        gap: 8px;
    }
}

/* ── Mobile (≤ 640px): tighten everything ── */
@media (max-width: 640px) {
    /* Hero */
    .pat-hero-banner {
        min-height: unset;
        padding: 26px 0 36px;
        background-position: center center;
    }

    .pat-hero-title {
        font-size: 1.75rem;
        letter-spacing: -0.3px;
    }

    .pat-hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 16px;
    }

    .pat-stats-pills {
        gap: 7px;
    }

    .pat-stat-pill {
        font-size: 0.78rem;
        padding: 5px 12px;
        gap: 6px;
    }

    /* Main section spacing */
    .pat-main-section {
        padding: 24px 0 60px;
    }

    .pat-layout-grid {
        gap: 16px;
    }

    /* Sidebar filter panel */
    .pat-sidebar-header {
        padding: 10px 14px 8px;
    }

    .pat-sidebar-title {
        font-size: 0.72rem;
    }

    .pat-sidebar-nav {
        padding: 8px 10px;
    }

    .pat-nav-item {
        padding: 9px 10px;
        font-size: 0.85rem;
    }

    .pat-nav-name {
        white-space: normal;
        line-height: 1.3;
    }

    .pat-subnav {
        padding: 4px 4px 8px 6px !important;
        gap: 5px !important;
    }

    .pat-subnav-item {
        font-size: 0.75rem;
        padding: 4px 10px;
    }

    /* Topbar */
    .pat-topbar {
        padding: 14px;
        gap: 12px;
    }

    .pat-topbar-info h2 {
        font-size: 1.25rem;
    }

    .pat-topbar-info p {
        font-size: 0.82rem;
    }

    .pat-search-input {
        height: 40px;
        font-size: 0.85rem;
    }

    /* Cards */
    .pat-card {
        padding: 14px 14px;
    }

    .pat-card-header {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 7px;
    }

    .pat-card-title {
        font-size: 1rem;
    }

    .pat-status-pill {
        font-size: 0.72rem;
        padding: 3px 8px;
    }

    .pat-card-details {
        font-size: 0.8rem;
    }

    .pat-card-meta {
        gap: 8px 12px;
        font-size: 0.78rem;
    }

    .pat-card-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .pat-card-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Category / subcategory headers */
    .pat-category-header h3 {
        font-size: 1.1rem;
    }

    .pat-subcategory-header h4 {
        font-size: 0.95rem;
    }

    /* Modal */
    .pat-modal-overlay {
        padding: 10px;
        align-items: flex-end;
    }

    .pat-modal-dialog {
        max-height: 92vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        margin: 0;
        width: 100%;
    }

    .pat-modal-header {
        padding: 14px 16px;
    }

    .pat-modal-header h3 {
        font-size: 1rem;
    }

    .pat-modal-body {
        padding: 16px;
        gap: 14px;
    }

    .pat-modal-title {
        font-size: 1.05rem;
    }

    .pat-modal-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 12px;
    }

    .pat-modal-footer {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .pat-modal-footer > div {
        justify-content: stretch;
    }

    .pat-modal-footer .pat-btn {
        flex: 1;
        justify-content: center;
    }

    /* Toast */
    .pat-toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        border-radius: var(--radius-md);
        font-size: 0.84rem;
        padding: 10px 16px;
    }
}

/* ── Extra small (≤ 400px): ultra-compact tweaks ── */
@media (max-width: 400px) {
    .pat-hero-title {
        font-size: 1.5rem;
    }

    .pat-stats-pills {
        gap: 6px;
    }

    .pat-stat-pill {
        font-size: 0.73rem;
        padding: 4px 10px;
    }

    .pat-modal-grid {
        grid-template-columns: 1fr;
    }
}