/* Custom CSS Design System - Dockpoly Dashboard */

:root {
    --bg-main: #080a10;
    --bg-card: rgba(17, 21, 34, 0.75);
    --bg-card-hover: rgba(24, 30, 48, 0.9);
    --bg-input: rgba(12, 16, 26, 0.95);
    --border-color: rgba(255, 255, 255, 0.07);
    --border-highlight: rgba(99, 102, 241, 0.35);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.3);
    
    --cyan: #06b6d4;
    --emerald: #10b981;
    --emerald-glow: rgba(16, 185, 129, 0.25);
    --rose: #f43f5e;
    --amber: #f59e0b;
    --purple: #a855f7;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden !important;
}

body {
    width: 100%;
    max-width: 100vw;
}

/* Display Visibility Helpers */
.desktop-only { display: flex !important; }
.mobile-only { display: none !important; }

/* Custom Glassmorphic Theme Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0c101a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.35);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.65);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    background-image: 
        radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
        radial-gradient(at 90% 90%, rgba(6, 182, 212, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 1360px;
    margin: 0 auto;
    padding: 24px 32px;
    width: 100%;
    box-sizing: border-box;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    background: rgba(17, 21, 34, 0.88);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.1);
    margin-bottom: 32px;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
    position: sticky;
    top: 16px;
    z-index: 1000;
}

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

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 20px var(--primary-glow);
    flex-shrink: 0;
}

.brand-text {
    min-width: 0;
}

.brand-text h1 {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 30%, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.badge-tag {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cyan);
    display: block;
}

/* Nav Tabs */
.nav-tabs {
    display: flex;
    background: rgba(12, 16, 26, 0.85);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    gap: 4px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.nav-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

/* Hamburger & Mobile Actions */
.mobile-actions-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.hamburger-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Enterprise Mobile Sidebar Drawer Backdrop */
.mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Sidebar Drawer Sheet */
.mobile-sidebar-drawer {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 310px;
    max-width: 85vw;
    background: #0d111c;
    border-left: 1px solid var(--border-color);
    box-shadow: -15px 0 40px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px 20px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-sidebar-backdrop.active .mobile-sidebar-drawer {
    transform: translateX(0);
}

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

.logo-icon.sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.close-sidebar-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 26px;
    cursor: pointer;
    transition: var(--transition);
}

.close-sidebar-btn:hover {
    color: #fff;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 20px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
}

.sidebar-nav-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-nav-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-hover);
    box-shadow: 0 4px 14px var(--primary-glow);
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Views */
.view-panel {
    display: none;
    animation: fadeIn 0.25s ease;
    width: 100%;
}

.view-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stats Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
    width: 100%;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    min-width: 0;
}

.stat-card:hover {
    border-color: var(--border-highlight);
    transform: translateY(-2px);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.purple { background: rgba(99, 102, 241, 0.12); color: var(--primary); }
.stat-icon.cyan { background: rgba(6, 182, 212, 0.12); color: var(--cyan); }
.stat-icon.emerald { background: rgba(16, 185, 129, 0.12); color: var(--emerald); }

.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 2px; }

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
    width: 100%;
}

.section-header h2 { font-size: 20px; font-weight: 700; }
.subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.container-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    width: 100%;
}

/* Skeleton Loaders */
.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.skeleton-box {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Container Card */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.container-title-group {
    min-width: 0;
    flex: 1;
}

.container-title-group h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #fff;
}

.image-tag {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 8px;
    border-radius: 6px;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.badge.running { background: rgba(16, 185, 129, 0.12); color: var(--emerald); border: 1px solid rgba(16, 185, 129, 0.25); }
.badge.paused { background: rgba(245, 158, 11, 0.12); color: var(--amber); border: 1px solid rgba(245, 158, 11, 0.25); }
.badge.stopped { background: rgba(244, 63, 94, 0.12); color: var(--rose); border: 1px solid rgba(244, 63, 94, 0.25); }

.badge-official {
    font-size: 10px;
    font-weight: 700;
    color: var(--cyan);
    background: rgba(6, 182, 212, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.copy-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    max-width: 100%;
    min-width: 0;
}

.copy-badge-text {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
    vertical-align: middle;
}

.copy-badge:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: var(--primary-glow);
    color: #fff;
}

.copy-badge.copied {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: var(--emerald) !important;
    color: var(--emerald) !important;
    animation: copyPulse 0.3s ease;
}

.copy-icon {
    opacity: 0.6;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.copy-badge:hover .copy-icon {
    opacity: 1;
}

@keyframes copyPulse {
    0% { transform: scale(0.96); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

.card-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    width: 100%;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    gap: 8px;
    min-width: 0;
}

.detail-row span:last-child {
    color: var(--text-main);
    font-weight: 500;
    min-width: 0;
}

.url-link-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(99, 102, 241, 0.08);
    border: 1px dashed rgba(99, 102, 241, 0.25);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    text-decoration: none;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
    min-width: 0; /* CRITICAL: Enables flex child text truncation without forcing parent expansion */
    width: 100%;
}

.url-link-box span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

.url-link-box:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
}

/* Professional Action Toolbar Strip */
.card-action-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    background: rgba(12, 16, 26, 0.6);
    border: 1px solid var(--border-color);
    padding: 6px;
    border-radius: 10px;
    width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
}

.action-btn-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 18px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.18);
}

.btn-start {
    background: rgba(16, 185, 129, 0.12);
    color: var(--emerald);
    border-color: rgba(16, 185, 129, 0.25);
}
.btn-start:hover:not(:disabled) {
    background: var(--emerald);
    color: #fff;
}

.btn-stop {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border-color: var(--border-color);
}
.btn-stop:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.btn-pause {
    background: rgba(245, 158, 11, 0.12);
    color: var(--amber);
    border-color: rgba(245, 158, 11, 0.25);
}
.btn-pause:hover:not(:disabled) {
    background: var(--amber);
    color: #000;
}

.btn-inspect {
    background: rgba(6, 182, 212, 0.12);
    color: var(--cyan);
    border-color: rgba(6, 182, 212, 0.25);
}
.btn-inspect:hover:not(:disabled) {
    background: var(--cyan);
    color: #000;
}

.btn-danger {
    background: rgba(244, 63, 94, 0.12);
    color: var(--rose);
    border-color: rgba(244, 63, 94, 0.25);
}
.btn-danger:hover:not(:disabled) {
    background: var(--rose);
    color: #fff;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.spinner-sm {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

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

/* Enhanced Presets Section */
.presets-section {
    margin-bottom: 22px;
}

.preset-label {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.preset-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
    min-width: 0;
}

.preset-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.preset-card.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
    box-shadow: 0 0 14px var(--primary-glow);
}

.preset-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.preset-icon.cyan { background: rgba(6, 182, 212, 0.15); color: var(--cyan); }
.preset-icon.purple { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.preset-icon.emerald { background: rgba(16, 185, 129, 0.15); color: var(--emerald); }
.preset-icon.rose { background: rgba(244, 63, 94, 0.15); color: var(--rose); }
.preset-icon.amber { background: rgba(245, 158, 11, 0.15); color: var(--amber); }

.preset-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.preset-text strong {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preset-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: var(--rose);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    padding: 0;
    z-index: 2;
    transition: var(--transition);
}

.preset-card:hover .preset-remove-btn { display: flex; }
.preset-remove-btn:hover { background: var(--rose); color: #fff; }

.preset-custom-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.preset-text span {
    font-size: 11px;
    color: var(--text-muted);
}

/* Docker Hub Auto-Complete Dropdown */
.search-container { position: relative; }

.autocomplete-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; margin-top: 6px;
    background: #111522; border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); max-height: 260px; overflow-y: auto;
    z-index: 1200; box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

.autocomplete-dropdown.hidden { display: none; }

.autocomplete-item {
    padding: 10px 14px; display: flex; justify-content: space-between;
    align-items: center; cursor: pointer; border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: var(--transition);
}

.autocomplete-item:hover { background: rgba(99, 102, 241, 0.15); }
.autocomplete-item-name { font-weight: 600; font-size: 13.5px; color: #fff; }
.autocomplete-item-desc { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.autocomplete-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--amber); }

/* Data Tables */
.table-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13.5px;
}

.data-table th, .data-table td { padding: 14px 20px; border-bottom: 1px solid var(--border-color); }
.data-table th { background: rgba(255, 255, 255, 0.02); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.data-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* Modals */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.modal-backdrop.active { opacity: 1; pointer-events: auto; }
.modal-card { background: #111522; border: 1px solid var(--border-color); border-radius: var(--radius-lg); width: 100%; max-width: 600px; box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6); padding: 28px; transform: scale(0.96); transition: transform 0.2s ease; max-height: 90vh; overflow-y: auto; box-sizing: border-box; }
.modal-card.small { max-width: 440px; }
.modal-card.wide { max-width: 820px; }
.modal-backdrop.active .modal-card { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.modal-header h3 { font-size: 19px; font-weight: 700; }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.danger-header { display: flex; align-items: center; gap: 14px; }
.alert-icon { width: 42px; height: 42px; border-radius: 12px; background: rgba(244, 63, 94, 0.12); color: var(--rose); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.close-btn { background: none; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer; }
.close-btn:hover { color: #fff; }

/* Inspect Tabs */
.inspect-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--border-color); margin-bottom: 20px; overflow-x: auto; }
.tab-btn { padding: 10px 16px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content.hidden { display: none; }
.inspect-info-grid { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }

/* Config Cards */
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; width: 100%; }
.config-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 24px; }
.config-card h3 { font-size: 16px; margin-bottom: 16px; }
.config-list { display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.config-item { display: flex; justify-content: space-between; padding: 10px 14px; background: rgba(255,255,255,0.02); border-radius: var(--radius-sm); border: 1px solid var(--border-color); }
.config-item span { color: var(--text-muted); }

/* Form Components */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.form-hint { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; margin-top: -2px; }
input[type="text"] { width: 100%; padding: 11px 15px; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: #fff; font-family: inherit; font-size: 13.5px; box-sizing: border-box; }
input[type="text"]:focus { outline: none; border-color: var(--primary); }
.env-header { display: flex; justify-content: space-between; align-items: center; }
.btn-text { background: none; border: none; color: var(--cyan); font-size: 13px; font-weight: 600; cursor: pointer; }
.env-row { display: flex; gap: 10px; margin-bottom: 10px; }
.form-checkbox { display: flex; align-items: center; gap: 10px; margin: 18px 0; font-size: 13px; color: var(--text-muted); }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* Code Block */
.code-block { background: #080a10; border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 16px; font-family: monospace; font-size: 12.5px; color: var(--cyan); max-height: 360px; overflow-y: auto; word-break: break-all; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 2000; }
.toast { padding: 12px 18px; background: #141927; border: 1px solid var(--border-color); border-left: 4px solid var(--primary); border-radius: var(--radius-sm); color: #fff; font-size: 13.5px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); animation: slideIn 0.3s ease; }
.toast.success { border-left-color: var(--emerald); }
.toast.error { border-left-color: var(--rose); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ==========================================================================
   STRICT OVERFLOW-FREE RESPONSIVE BREAKPOINTS (Desktops, Laptops, Tablets, Mobile)
   ========================================================================== */

/* 1. Laptops & Small Desktops (< 1200px) */
@media screen and (max-width: 1200px) {
    .app-container {
        padding: 20px 24px;
    }

    .container-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 18px;
    }
}

/* 2. Tablets & Mobile Screens (< 992px) - Swaps Desktop Navbar to Mobile Sidebar Drawer */
@media screen and (max-width: 992px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }

    .navbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        margin-bottom: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 14px;
    }

    .container-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .copy-badge-text {
        max-width: 160px;
    }
}

/* 3. Mobile Landscape & Small Tablets (< 768px) */
@media screen and (max-width: 768px) {
    .app-container {
        padding: 14px 12px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .section-header button {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .container-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .modal-card {
        padding: 20px 14px;
        border-radius: var(--radius-md);
        max-height: 94vh;
    }

    .presets-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }

    .preset-card {
        padding: 8px 10px;
        gap: 8px;
    }

    .preset-icon {
        width: 28px;
        height: 28px;
    }

    .card-action-strip {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .action-btn-group {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }

    .action-btn-group .btn {
        width: 100%;
        padding: 7px 4px;
        font-size: 11px;
        justify-content: center;
    }

    .card-action-strip .open-delete-modal-btn {
        width: 100%;
    }

    .data-table th, .data-table td {
        padding: 10px 12px;
    }

    .copy-badge-text {
        max-width: 120px;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   OVERVIEW DASHBOARD — Resource Charts (Gauge, Memory Bar, Breakdown List)
   ========================================================================== */

.overview-charts-grid {
    display: grid;
    grid-template-columns: minmax(220px, 320px) 1fr;
    gap: 20px;
    margin-bottom: 32px;
    width: 100%;
}

.chart-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 22px;
    width: 100%;
    box-sizing: border-box;
}

.chart-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.chart-card .subtitle { margin-bottom: 18px; }

.gauge-wrap {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto;
}

.gauge-svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.gauge-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 12;
}

.gauge-value {
    fill: none;
    stroke: var(--cyan);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 364.4;
    stroke-dashoffset: 364.4;
    transition: stroke-dashoffset 0.6s ease, stroke 0.3s ease;
}

.gauge-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gauge-num { font-size: 26px; font-weight: 800; color: #fff; }
.gauge-lbl { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.mem-bar-track {
    width: 100%;
    height: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    margin-bottom: 22px;
}

.mem-bar-fill {
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--emerald), var(--cyan));
    width: 0%;
    transition: width 0.6s ease, background 0.3s ease;
}

.mem-bar-fill.warn { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.mem-bar-fill.danger { background: linear-gradient(90deg, var(--rose), #fb7185); }

.resource-bar-list { display: flex; flex-direction: column; gap: 12px; }

.resource-bar-row { display: flex; align-items: center; gap: 12px; }

.resource-bar-name {
    flex: 0 0 130px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-bar-track {
    flex: 1;
    height: 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.resource-bar-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--primary), var(--cyan));
    transition: width 0.5s ease;
}

.resource-bar-value {
    flex: 0 0 48px;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    font-family: monospace;
}

.mini-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: var(--transition);
    width: 100%;
    box-sizing: border-box;
}

.mini-card:hover {
    border-color: var(--border-highlight);
    transform: translateY(-2px);
}

.mini-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.mini-card-header h4 { font-size: 14.5px; font-weight: 700; color: #fff; }
.mini-card-meta { font-size: 12px; color: var(--text-dim); display: flex; justify-content: space-between; }

@media screen and (max-width: 992px) {
    .overview-charts-grid { grid-template-columns: 1fr; }
}

/* 4. Small Mobile Portrait (< 480px) */
@media screen and (max-width: 480px) {
    .brand-text h1 {
        font-size: 15px;
    }

    .badge-tag {
        font-size: 9.5px;
    }

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

    .stat-card {
        padding: 14px 16px;
    }

    .card {
        padding: 14px 12px;
    }

    .env-row {
        flex-direction: column;
        gap: 6px;
    }

    .env-row .remove-env {
        align-self: flex-end;
    }

    .copy-badge-text {
        max-width: 95px;
    }

    .copy-badge {
        padding: 2px 6px;
        font-size: 11px;
    }

    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .toast {
        width: 100%;
    }
}
