:root {
    --bg-color: #f8fafc;
    --panel-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --terminal-bg: #0f172a;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.login-wrapper {
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 2rem;
        }
        .login-container { 
            width: 100%;
            max-width: 420px; 
            padding: 2.5rem; 
             backdrop-filter: blur(12px);
            border-radius: 16px; 
            box-shadow: 0 10px 25px rgba(0,0,0,0.3); 
            border: 1px solid rgba(255, 255, 255, 0.1); 
        }
        .login-container h2 { 
            margin-top: 0; 
            margin-bottom: 2rem; 
            color: var(--text-primary); 
            text-align: center;
            font-size: 1.8rem;
            font-weight: 600;
        }
        .login-container .form-group { 
            margin-bottom: 1.5rem; 
        }
        .login-container label {
            display: block;
            margin-bottom: 0.5rem;
            font-size: 0.875rem;
            color: var(--text-secondary);
        }
        .login-container input { 
            width: 100%; 
            padding: 0.85rem; 
            border: 1px solid rgba(255, 255, 255, 0.1); 
            border-radius: 8px; 
            box-sizing: border-box; 
             color: var(--text-primary);
            font-size: 1rem;
            transition: all 0.2s;
        }
        .login-container input:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
        }
        .login-container button { 
            width: 100%; 
            padding: 0.85rem; 
            background: linear-gradient(135deg, #3b82f6, #2563eb); 
            color: white; 
            border: none; 
            border-radius: 8px; 
            cursor: pointer; 
            font-weight: 600; 
            font-size: 1rem; 
            transition: opacity 0.2s;
            margin-top: 1rem;
        }
        .login-container button:hover { 
            opacity: 0.9;
        }

.app-container {
    max-width: 1600px;
    width: 100%;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

header {
    text-align: center;
    margin-bottom: 1rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    grid-template-areas: 
        "settings scripts"
        "terminal terminal";
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

.settings-panel { grid-area: settings;   }
.scripts-panel { grid-area: scripts;   }
.terminal-panel { grid-area: terminal; }

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.panel h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.input-row {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 0.5rem;
    padding: 0 1rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

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

.scripts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.script-btn {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.875rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.script-btn::before {
    content: '▶';
    position: absolute;
    right: 1rem;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s ease;
}

.script-btn:hover {
    background: #f8fafc;
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.script-btn:hover::before {
    opacity: 1;
    transform: translateX(0);
}

.script-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Terminal Styles */
.terminal-panel {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    height: 400px; /* Reduced fixed height */
}

.terminal-header {
    background: #1e1e1e;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid #333;
}

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

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.terminal-title {
    margin-left: 1rem;
    color: #888;
    font-size: 0.85rem;
    font-family: monospace;
}

.terminal-body {
    background: var(--terminal-bg);
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    color: #e2e8f0;
    line-height: 1.5;
}

.log-line {
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 0.2rem;
}

.text-muted {
    color: #64748b;
}

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

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.top-nav {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.top-nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    transition: all 0.2s ease;
}

.top-nav-link:hover,
.top-nav-link.is-active {
    color: var(--text-primary);
    border-color: rgba(37, 99, 235, 0.35);
    background: rgba(37, 99, 235, 0.08);
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.nav-shortcut {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.funding-body {
    background:
        radial-gradient(circle at top left, rgba(245, 158, 11, 0.14), transparent 28%),
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.12), transparent 32%),
        linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.funding-app {
    gap: 1.75rem;
}

.funding-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem 1.75rem;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 251, 235, 0.95));
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.eyebrow {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #b45309;
    margin-bottom: 0.6rem;
    font-weight: 600;
}

.hero-copy {
    max-width: 58rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.funding-header h1 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
}

.funding-main {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.funding-panel {
    min-height: 0;
}

.panel-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.panel-copy {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.35rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    height: fit-content;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.accent-pill {
    background: #fff7ed;
    color: #c2410c;
}

.preview-card {
    border: 1px solid var(--border-color);
    border-radius: 0.85rem;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255, 255, 255, 1));
    overflow: hidden;
}

.preview-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.preview-file {
    color: var(--text-primary);
    font-size: 0.82rem;
}

.json-preview {
    margin: 0;
    padding: 1rem;
    min-height: 240px;
    max-height: 320px;
    overflow: auto;
    background: #0f172a;
    color: #dbeafe;
    font-size: 0.86rem;
    line-height: 1.55;
}

.action-row,
.button-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.primary-action,
.highlight-btn {
    background: linear-gradient(135deg, #ea580c, #f59e0b);
    color: white;
    border-color: transparent;
}

.primary-action:hover,
.highlight-btn:hover {
    background: linear-gradient(135deg, #c2410c, #ea580c);
    color: white;
}

.helper-text {
    margin-top: 0.85rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.helper-text[data-tone="success"] {
    color: var(--success);
}

.helper-text[data-tone="danger"] {
    color: var(--danger);
}

.funding-terminal-panel {
    grid-column: 1 / -1;
    min-height: 430px;
}

.funding-terminal-header {
    justify-content: space-between;
}

@media (max-width: 960px) {
    .funding-header {
        flex-direction: column;
        gap: 1rem;
    }

    .funding-main {
        grid-template-columns: 1fr;
    }

    .funding-terminal-panel {
        min-height: 360px;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }

    main {
        grid-template-columns: 1fr;
        grid-template-areas:
            "settings"
            "scripts"
            "terminal";
    }

    .form-row,
    .input-row,
    .header-actions {
        flex-direction: column;
    }

    .btn-icon {
        min-height: 44px;
    }
}
