:root {
    --bg-main: #0F1219;
    --bg-panel: rgba(25, 30, 40, 0.6);
    --bg-panel-solid: #191E28;
    --bg-input: #12151D;

    --text-main: #F3F4F6;
    --text-muted: #9CA3AF;
    --text-dark: #6B7280;

    --primary: #EF4444;
    --primary-hover: #DC2626;
    --primary-light: rgba(239, 68, 68, 0.15);

    --secondary: #F87171;
    --accent: #10B981;
    --accent-light: rgba(16, 185, 129, 0.15);

    --warning: #F59E0B;
    --warning-light: rgba(245, 158, 11, 0.15);

    --info: #3B82F6;
    --info-light: rgba(59, 130, 246, 0.15);

    --border: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(255, 255, 255, 0.15);

    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 4px;

    --font-sans: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

.text-accent {
    color: var(--accent);
}

.text-primary {
    color: var(--primary);
}

.text-secondary {
    color: var(--secondary);
}

.text-warning {
    color: var(--warning);
}

.text-info {
    color: var(--info);
}

.text-gray {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.875rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex {
    display: flex;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.gap-2 {
    gap: 0.5rem;
}

.w-full {
    width: 100%;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--border-highlight);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--text-dark);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-header {
    height: 64px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    background: var(--bg-main);
    z-index: 10;
}

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

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    width: 18px;
    height: 18px;
}

h1 {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-panel {
    border-right: 1px solid var(--border);
    background: var(--bg-input);
    width: 40%;
    min-width: 300px;
    flex: none;
}

.analysis-panel {
    background: var(--bg-main);
    flex: 1;
    position: relative;
}

.editor-header {
    height: 48px;
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    background: var(--bg-panel-solid);
}

.editor-header:first-child {
    border-top: none;
}

.editor-header h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dark);
    font-weight: 600;
}

.code-editor {
    flex: 1;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    padding: 16px;
    resize: none;
    outline: none;
    line-height: 1.6;
}

.code-editor::placeholder {
    color: var(--text-dark);
}

.editor-secondary {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
}

.editor-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-panel-solid);
}

.error-msg {
    margin-top: 12px;
    padding: 10px;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-family: var(--font-mono);
    word-break: break-all;
}

.empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
}

.empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.empty-icon svg {
    width: 32px;
    height: 32px;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.875rem;
    max-width: 300px;
}

.results-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel-solid);
    padding: 0 16px;
    flex-shrink: 0;
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 500;
    padding: 16px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab:hover {
    color: var(--text-main);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.badge {
    background: var(--border);
    color: var(--text-main);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: 600;
}

.tab.active .badge {
    background: var(--primary-light);
    color: var(--primary);
}

.tab-content-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    position: relative;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn {
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 10px 16px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: var(--border);
    color: var(--text-main);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-highlight);
    color: var(--text-main);
    padding: 6px 12px;
}

.btn-outline:hover {
    background: var(--border);
}

.btn-icon {
    background: transparent;
    color: var(--text-dark);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.btn-icon:hover {
    background: var(--border);
    color: var(--text-main);
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

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

.toggle-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-input);
    border: 1px solid var(--border-highlight);
    transition: .3s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-light);
    border-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(16px);
    background-color: var(--primary);
}

.overview-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.overview-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.version-tag {
    background: var(--border);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

.pkg-desc {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 800px;
}

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

.stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    backdrop-filter: blur(10px);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
    line-height: 1.2;
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-dark);
}

.alert-card {
    background: var(--warning-light);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    border-left: 4px solid var(--warning);
    font-size: 0.875rem;
    color: #FCD34D;
}

.alert-card.error {
    background: var(--primary-light);
    border-color: rgba(239, 68, 68, 0.3);
    border-left-color: var(--primary);
    color: #FCA5A5;
}

.alert-card.info {
    background: var(--info-light);
    border-color: rgba(59, 130, 246, 0.3);
    border-left-color: var(--info);
    color: #93C5FD;
}

.filters {
    display: flex;
    gap: 12px;
}

.search-input,
.select-input {
    background: var(--bg-panel-solid);
    border: 1px solid var(--border-highlight);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus,
.select-input:focus {
    border-color: var(--primary);
}

.search-input {
    width: 250px;
}

.table-container {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

.data-table th {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.badge-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.70rem;
    font-weight: 600;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

.badge-tag.dep {
    background: var(--info-light);
    color: #93C5FD;
}

.badge-tag.dev {
    background: var(--border);
    color: var(--text-muted);
}

.badge-tag.peer {
    background: var(--warning-light);
    color: #FCD34D;
}

.version-str {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

.range-exact {
    color: var(--text-muted);
}

.range-caret {
    color: var(--accent);
}

.range-tilde {
    color: var(--warning);
}

.range-wild {
    color: var(--primary);
    font-weight: bold;
}

.status-ok {
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-warn {
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: 4px;
}

.scripts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 16px;
}

.script-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.script-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.script-name {
    font-family: var(--font-mono);
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.95rem;
}

.script-tool {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.script-cmd {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 10px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    word-break: break-all;
}

.script-analysis {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.script-analysis ul {
    margin-left: 16px;
    margin-top: 4px;
}

.script-analysis li {
    margin-bottom: 2px;
}

.graph-container {
    height: 500px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: grab;
}

.graph-container:active {
    cursor: grabbing;
}

.graph-container svg {
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.node text {
    font-family: var(--font-sans);
    font-size: 12px;
    fill: var(--text-main);
    font-weight: 500;
}

.node-sub text {
    font-size: 10px;
    fill: var(--text-muted);
}

.link {
    fill: none;
    stroke: var(--border-highlight);
    stroke-width: 1.5px;
}

.node circle {
    fill: var(--bg-panel-solid);
    stroke: var(--primary);
    stroke-width: 2px;
}

.node.root circle {
    fill: var(--primary-light);
    stroke: var(--primary);
    stroke-width: 3px;
    r: 16;
}

.diff-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.diff-stat {
    font-size: 0.875rem;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-weight: 600;
}

.diff-add {
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.diff-rem {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.diff-mod {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.diff-item {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    display: flex;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
}

.diff-path {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    width: 200px;
    border-right: 1px solid var(--border);
    color: var(--text-muted);
}

.diff-changes {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.diff-line {
    padding: 4px 12px;
    display: flex;
    gap: 16px;
}

.diff-line.add {
    background: rgba(16, 185, 129, 0.1);
    color: #6EE7B7;
}

.diff-line.del {
    background: rgba(239, 68, 68, 0.1);
    color: #FCA5A5;
    text-decoration: line-through;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: white;
    color: var(--bg-main);
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    z-index: 100;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}