/* PathFinder - Mobile-First Native-Like Design */

:root {
    /* Color System */
    --md-sys-color-surface-00: #0b0e14;
    --md-sys-color-surface-01: #151923;
    --md-sys-color-surface-02: #1e2532;
    --md-sys-color-surface-03: #2a3345;

    --md-sys-color-primary: #a5b4fc;
    --md-sys-color-on-primary: #1e1b4b;
    --md-sys-color-primary-container: #4338ca;
    --md-sys-color-on-primary-container: #e0e7ff;

    --md-sys-color-secondary: #5eead4;
    --md-sys-color-tertiary: #f472b6;

    --md-sys-color-outline: #475569;
    --md-sys-color-outline-variant: #334155;

    --color-risk-high: #ff6b6b;
    --color-risk-med: #fbbf24;
    --color-risk-low: #34d399;

    --md-sys-color-on-surface: #f1f5f9;
    --md-sys-color-on-surface-variant: #94a3b8;

    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono: ui-monospace, 'SF Mono', monospace;

    /* Mobile-first sizing */
    --header-height: 56px;
    --sidebar-width: 320px;
    --bottom-sheet-peek: 0px;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);

    /* Touch-friendly sizes */
    --touch-target: 48px;
    --touch-target-min: 44px;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-ui);
    background-color: var(--md-sys-color-surface-00);
    color: var(--md-sys-color-on-surface);
    height: 100%;
    overflow: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

/* Utilities */
.surface-00 { background-color: var(--md-sys-color-surface-00); }
.surface-01 { background-color: var(--md-sys-color-surface-01); }
.surface-02 { background-color: var(--md-sys-color-surface-02); }
.surface-03 { background-color: var(--md-sys-color-surface-03); }

/* ==========================================
   APP LAYOUT - Mobile First
   ========================================== */

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh; /* Dynamic viewport height for mobile */
    width: 100%;
    overflow: hidden;
    position: relative;
}

/* ==========================================
   MOBILE HEADER
   ========================================== */

.mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 8px;
    padding-top: var(--safe-area-top);
    background: var(--md-sys-color-surface-01);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    z-index: 100;
    flex-shrink: 0;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-brand .brand-icon {
    font-size: 24px;
    color: var(--md-sys-color-primary);
}

.header-brand .brand-text {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

/* ==========================================
   SIDEBAR / DRAWER
   ========================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(85vw, 320px);
    height: 100%;
    height: 100dvh;
    z-index: 200;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    will-change: transform;
    overflow: hidden;
}

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

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    padding-top: calc(16px + var(--safe-area-top));
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 28px;
    color: var(--md-sys-color-primary);
}

.brand-text {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.nav-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--md-sys-color-primary);
    opacity: 0.8;
}

.nav-divider {
    height: 1px;
    background: var(--md-sys-color-outline-variant);
    margin: 4px 0;
}

.sidebar-footer {
    padding: 16px 20px;
    padding-bottom: calc(16px + var(--safe-area-bottom));
    border-top: 1px solid var(--md-sys-color-outline-variant);
    font-family: var(--font-mono);
    font-size: 12px;
}

/* ==========================================
   QUICK STATS (Mobile Drawer)
   ========================================== */

.quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.quick-stat {
    text-align: center;
    padding: 12px 8px;
    background: var(--md-sys-color-surface-02);
    border-radius: 12px;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.quick-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--md-sys-color-on-surface);
}

.quick-stat-label {
    display: block;
    font-size: 10px;
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.quick-stat.risk-high .quick-stat-value { color: var(--color-risk-high); }
.quick-stat.risk-low .quick-stat-value { color: var(--color-risk-low); }

/* ==========================================
   FORM CONTROLS - Touch Optimized
   ========================================== */

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-label {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
}

/* Search */
#search-control {
    position: relative;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrapper .search-icon {
    position: absolute;
    left: 14px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 22px;
    pointer-events: none;
}

.md-input {
    width: 100%;
    background: var(--md-sys-color-surface-02);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 28px;
    padding: 14px 48px 14px 48px;
    color: var(--md-sys-color-on-surface);
    font-family: var(--font-ui);
    font-size: 16px; /* Prevents iOS zoom */
    transition: all 0.2s;
}

.md-input::placeholder {
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.7;
}

.md-input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.2);
}

.btn-icon-small {
    position: absolute;
    right: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-small:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--md-sys-color-surface-03);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 16px;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
    display: none;
    overscroll-behavior: contain;
}

.search-dropdown.show {
    display: block;
}

.search-result-item {
    padding: 16px 20px;
    cursor: pointer;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    transition: background 0.15s;
    min-height: var(--touch-target);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:active {
    background: rgba(165, 180, 252, 0.15);
}

.search-result-item.selected {
    background: rgba(165, 180, 252, 0.1);
}

.search-result-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 4px;
}

.search-result-meta {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-result-risk {
    font-family: var(--font-mono);
    font-weight: 500;
}

.search-no-results,
.search-loading {
    padding: 24px;
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 14px;
}

.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

/* Select */
.select-wrapper {
    position: relative;
}

.md-select {
    width: 100%;
    background: var(--md-sys-color-surface-02);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 12px;
    padding: 14px 40px 14px 16px;
    color: var(--md-sys-color-on-surface);
    font-family: var(--font-ui);
    font-size: 16px;
    appearance: none;
    cursor: pointer;
    min-height: var(--touch-target);
}

.md-select:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}

.select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--md-sys-color-on-surface-variant);
}

/* Toggle Group */
.toggle-group {
    display: flex;
    gap: 0;
    background: var(--md-sys-color-surface-02);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid var(--md-sys-color-outline);
}

.toggle-btn {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--touch-target-min);
}

.toggle-btn .material-symbols-rounded {
    font-size: 18px;
}

.toggle-btn:active {
    transform: scale(0.98);
}

.toggle-btn.active {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

/* Sliders */
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider-value {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--md-sys-color-primary);
    font-weight: 500;
}

.md-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--md-sys-color-outline-variant);
    border-radius: 3px;
    outline: none;
    margin: 8px 0;
}

.md-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Buttons */
.btn-icon {
    width: var(--touch-target);
    height: var(--touch-target);
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-icon:active {
    background: rgba(255, 255, 255, 0.1);
}

.btn-icon .material-symbols-rounded {
    font-size: 24px;
}

.btn {
    border: none;
    border-radius: 100px;
    padding: 14px 28px;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    min-height: var(--touch-target);
}

.btn-filled {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    width: 100%;
}

.btn-filled:active {
    transform: scale(0.98);
    filter: brightness(0.9);
}

/* ==========================================
   MAIN CONTENT
   ========================================== */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

/* Stats Bar - Hidden on mobile */
.stats-bar {
    display: none;
}

/* Graph Container */
.viz-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-image: radial-gradient(var(--md-sys-color-outline-variant) 1px, transparent 1px);
    background-size: 24px 24px;
    touch-action: none; /* Allow custom touch handling */
}

.viz-container svg {
    display: block;
    touch-action: none;
}

/* Loading State */
.loading-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 10;
}

.spinner-material {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(165, 180, 252, 0.2);
    border-top-color: var(--md-sys-color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile Legend */
.mobile-legend {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(21, 25, 35, 0.9);
    border-radius: 20px;
    border: 1px solid var(--md-sys-color-outline-variant);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 5;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.high { background: var(--color-risk-high); }
.legend-dot.med { background: var(--color-risk-med); }
.legend-dot.low { background: var(--color-risk-low); }

/* FAB Search Button */
.fab-search {
    position: absolute;
    bottom: 24px;
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(165, 180, 252, 0.4);
    z-index: 50;
    transition: transform 0.2s, box-shadow 0.2s;
}

.fab-search:active {
    transform: scale(0.95);
}

.fab-search .material-symbols-rounded {
    font-size: 24px;
}

/* ==========================================
   BOTTOM SHEET (Mobile Native Pattern)
   ========================================== */

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--md-sys-color-surface-02);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    will-change: transform;
}

.bottom-sheet.visible {
    transform: translateY(0);
}

.bottom-sheet.expanded {
    max-height: 95vh;
    border-radius: 0;
}

.bottom-sheet-handle {
    padding: 12px;
    display: flex;
    justify-content: center;
    cursor: grab;
    touch-action: none;
}

.handle-bar {
    width: 40px;
    height: 4px;
    background: var(--md-sys-color-outline);
    border-radius: 2px;
}

.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.bottom-sheet-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.bottom-sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.bottom-sheet-actions {
    padding: 16px 20px;
    padding-bottom: calc(16px + var(--safe-area-bottom));
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

/* ==========================================
   DETAIL CONTENT STYLES
   ========================================== */

.detail-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--md-sys-color-primary);
    margin-bottom: 12px;
    font-weight: 600;
}

.info-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    gap: 12px;
}

.info-row:last-child { margin-bottom: 0; }
.info-label { color: var(--md-sys-color-on-surface-variant); flex-shrink: 0; }
.info-val {
    color: var(--md-sys-color-on-surface);
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

.progress-container {
    height: 8px;
    background: var(--md-sys-color-outline-variant);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Tags */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 100px;
    background: var(--md-sys-color-surface-03);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
}

/* Transition Cards - Touch optimized */
.transition-card,
.transition-card-job {
    border-left: 4px solid var(--md-sys-color-secondary);
    cursor: pointer;
    transition: all 0.2s;
    min-height: var(--touch-target);
}

.transition-card:active,
.transition-card-job:active {
    background: rgba(165, 180, 252, 0.1);
    transform: translateX(4px);
}

/* Empty State */
.empty-state {
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-on-surface-variant);
    text-align: center;
    padding: 20px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ==========================================
   FULLSCREEN MODAL
   ========================================== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--md-sys-color-surface-00);
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal-surface {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    padding-top: calc(8px + var(--safe-area-top));
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-01);
    min-height: var(--header-height);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: calc(20px + var(--safe-area-bottom));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================
   D3 GRAPH STYLES - Touch Optimized
   ========================================== */

.node circle {
    stroke: var(--md-sys-color-surface-00);
    stroke-width: 2px;
}

.node.center-node circle {
    stroke: var(--md-sys-color-primary);
    stroke-width: 4px;
    filter: drop-shadow(0 0 12px rgba(165, 180, 252, 0.5));
}

.node.selected circle {
    stroke: var(--md-sys-color-secondary);
    stroke-width: 3px;
}

.node text {
    fill: var(--md-sys-color-on-surface);
    font-family: var(--font-ui);
    font-size: 11px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.link {
    stroke-opacity: 0.25;
}

/* Tooltip - Touch friendly */
.tooltip {
    position: fixed;
    background: rgba(30, 37, 50, 0.95);
    border: 1px solid var(--md-sys-color-outline-variant);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    font-size: 13px;
    z-index: 500;
    max-width: 280px;
    opacity: 0;
    transition: opacity 0.15s;
}

.tooltip.show { opacity: 1; }
.tooltip h3 {
    color: var(--md-sys-color-primary);
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}
.tooltip p {
    color: var(--md-sys-color-on-surface-variant);
    margin: 2px 0;
}

/* Stats Mini */
.stats-mini {
    display: flex;
    justify-content: space-between;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-label {
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
}

.stat-val {
    color: var(--md-sys-color-on-surface);
    font-weight: 600;
    font-size: 14px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--md-sys-color-outline-variant);
    border-radius: 2px;
}

/* Mobile only helper */
.mobile-only { display: flex; }
.desktop-only { display: none; }

/* ==========================================
   DESKTOP STYLES (min-width: 768px)
   ========================================== */

@media (min-width: 768px) {
    .mobile-header {
        display: none;
    }

    .mobile-only {
        display: none;
    }

    .desktop-only {
        display: flex;
    }

    .app-container {
        flex-direction: row;
    }

    .sidebar {
        position: relative;
        width: var(--sidebar-width);
        transform: none;
        border-right: 1px solid var(--md-sys-color-outline-variant);
        flex-shrink: 0;
    }

    .sidebar-overlay {
        display: none;
    }

    .sidebar-header {
        padding-top: 16px;
    }

    .main-content {
        flex: 1;
    }

    .stats-bar {
        display: flex;
        height: 56px;
        align-items: center;
        padding: 0 24px;
        gap: 20px;
        border-bottom: 1px solid var(--md-sys-color-outline-variant);
    }

    .stat-pill {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 16px;
        border-radius: 100px;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--md-sys-color-outline-variant);
    }

    .stat-pill.risk-high span { color: var(--color-risk-high); }
    .stat-pill.risk-low span { color: var(--color-risk-low); }

    .stat-text {
        font-size: 13px;
    }

    .stat-text strong {
        font-family: var(--font-mono);
    }

    .graph-legend {
        margin-left: auto;
        display: flex;
        gap: 16px;
    }

    .legend-item {
        font-size: 12px;
        display: flex;
        align-items: center;
        gap: 6px;
        color: var(--md-sys-color-on-surface-variant);
    }

    .dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
    }

    .dot.high { background: var(--color-risk-high); }
    .dot.med { background: var(--color-risk-med); }
    .dot.low { background: var(--color-risk-low); }

    .mobile-legend,
    .fab-search {
        display: none;
    }

    /* Desktop Bottom Sheet -> Side Panel */
    .bottom-sheet {
        position: absolute;
        top: 16px;
        right: 16px;
        bottom: 16px;
        left: auto;
        width: 400px;
        max-height: none;
        border-radius: 20px;
        transform: translateX(120%);
    }

    .bottom-sheet.visible {
        transform: translateX(0);
    }

    .bottom-sheet-handle {
        display: none;
    }

    .bottom-sheet-header {
        padding: 20px 24px;
    }

    .bottom-sheet-content {
        padding: 24px;
    }

    .bottom-sheet-actions {
        padding: 20px 24px;
    }

    /* Desktop Modal */
    .modal-backdrop {
        background: rgba(0, 0, 0, 0.6);
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .modal-surface {
        width: 90%;
        max-width: 900px;
        height: 85%;
        border-radius: 24px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    }

    .modal-header {
        padding: 20px 24px;
    }

    .modal-body {
        padding: 24px;
    }

    /* Graph adjustments */
    .viz-container {
        background-size: 32px 32px;
    }

    .node text {
        font-size: 10px;
    }

    ::-webkit-scrollbar { width: 8px; }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .sidebar {
        width: 340px;
    }

    .bottom-sheet {
        width: 440px;
    }
}

/* ==========================================
   TOUCH STATES & ANIMATIONS
   ========================================== */

@media (hover: none) and (pointer: coarse) {
    /* Touch device optimizations */
    .md-select,
    .md-input,
    .toggle-btn,
    .btn {
        cursor: default;
    }

    /* Larger touch targets */
    .search-result-item {
        padding: 18px 20px;
    }

    /* Remove hover states */
    .search-result-item:hover {
        background: transparent;
    }

    .btn-icon:hover {
        background: transparent;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================
   TRANSITION DETAILS - Responsive
   ========================================== */

.transition-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.transition-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.transition-header .from-to {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.transition-header .job-label {
    font-size: 13px;
    font-weight: 600;
    max-width: 140px;
    word-wrap: break-word;
}

.transition-header .arrow {
    font-size: 24px;
    color: var(--md-sys-color-primary);
    flex-shrink: 0;
}

.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.skill-tag {
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 100px;
    display: inline-block;
    margin: 3px;
}

.skill-tag.shared {
    background: rgba(52, 211, 153, 0.15);
}

.skill-tag.learn {
    background: rgba(251, 191, 36, 0.15);
}

@media (min-width: 600px) {
    .transition-grid {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }

    .transition-header {
        flex-direction: row;
        justify-content: space-between;
    }

    .transition-header .job-label {
        font-size: 14px;
        max-width: 180px;
    }

    .transition-header .arrow {
        font-size: 32px;
    }
}
