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

:root {
    --bg-primary: #f5f7fb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #e8f0fe;
    --text-primary: #1a1a2e;
    --text-secondary: #5f6368;
    --accent: #1a73e8;
    --accent-light: #4285f4;
    --accent-dark: #1557b0;
    --success: #0f9d58;
    --error: #d93025;
    --warning: #f9ab00;
    --border: #dadce0;
    --shadow: rgba(60, 64, 67, 0.1);
}

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.navbar {
    background: var(--accent);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px var(--shadow);
}

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

.nav-logo {
    font-size: 1.4rem;
}

.nav-title {
    font-weight: 700;
    font-size: 1rem;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    text-decoration: none;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.nav-logout {
    color: rgba(255, 255, 255, 0.7);
    margin-left: 8px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}

.section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--accent-dark);
}

.btn-primary:disabled {
    background: #94b8e8;
    cursor: not-allowed;
}

.btn-secondary {
    background: #e8f0fe;
    color: var(--accent);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #d2e3fc;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 1rem;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.table-container {
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    background: var(--bg-primary);
}

.data-table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

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

.clickable-row {
    cursor: pointer;
    transition: background 0.15s;
}

.clickable-row:hover {
    background: var(--bg-hover);
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-published {
    background: #e6f4ea;
    color: var(--success);
}

.badge-draft {
    background: #e8f0fe;
    color: var(--accent);
}

.badge-error {
    background: #fce8e6;
    color: var(--error);
}

.badge-processing {
    background: #fef7e0;
    color: var(--warning);
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-success {
    background: #e6f4ea;
    color: #137333;
    border: 1px solid #ceead6;
}

.alert-error {
    background: #fce8e6;
    color: #c5221f;
    border: 1px solid #f5c6c2;
}

.empty-state {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a73e8 0%, #4285f4 50%, #e8f0fe 100%);
}

.login-card {
    background: #ffffff;
    padding: 40px;
    border-radius: 16px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.login-header h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: #ffffff;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.login-form .btn {
    margin-top: 8px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

.status-running {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: #e8f0fe;
    border-radius: 8px;
    color: var(--accent);
    font-weight: 500;
}

.pipeline-info {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.pipeline-info h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
}

.pipeline-steps {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #e8f0fe;
    padding: 8px 14px;
    border-radius: 8px;
}

.step-number {
    width: 24px;
    height: 24px;
    background: var(--accent);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.step-text {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
}

.step-arrow {
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: bold;
}

.generate-actions {
    text-align: center;
    margin: 20px 0;
}

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

.setting-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
}

.setting-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.setting-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
}

.setting-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.setting-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 8px 0 12px;
}

.env-checklist {
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.env-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-family: 'SF Mono', 'Consolas', monospace;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--bg-primary);
}

.env-item.env-ok {
    color: var(--success);
}

.env-item.env-missing {
    color: var(--error);
}

.env-icon {
    font-weight: bold;
    width: 16px;
    text-align: center;
}

.improvement-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
}

.improvement-item {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.improvement-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.improvement-item h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 6px;
}

.improvement-item p {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.goals-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.goal-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
}

.goal-card h4 {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.goal-bar {
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.goal-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 4px;
    transition: width 0.5s;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.detail-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
}

.detail-card h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--accent);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.detail-value {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.story-content {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
    line-height: 1.8;
    font-size: 0.95rem;
}

.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--accent);
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 12px;
        flex-wrap: wrap;
        height: auto;
        padding: 8px 12px;
    }

    .nav-links {
        gap: 2px;
        flex-wrap: wrap;
    }

    .nav-link {
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    .container {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .detail-grid,
    .goals-grid {
        grid-template-columns: 1fr;
    }

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

    .pipeline-steps {
        flex-direction: column;
    }

    .step-arrow {
        transform: rotate(90deg);
    }

    .tab-nav {
        overflow-x: auto;
    }

    .pipeline-step-tracker {
        flex-wrap: wrap;
    }
}

.pipeline-step-tracker {
    display: flex;
    gap: 4px;
    align-items: center;
    margin: 16px 0;
    flex-wrap: wrap;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s;
}

.step-item.step-done {
    background: #e6f4ea;
    color: var(--success);
    border-color: var(--success);
}

.step-item.step-done .step-dot {
    background: var(--success);
}

.step-item.step-active {
    background: #e8f0fe;
    color: var(--accent);
    border-color: var(--accent);
    animation: stepPulse 1.5s ease-in-out infinite;
}

.step-item.step-active .step-dot {
    background: var(--accent);
    animation: dotPulse 1s ease-in-out infinite;
}

@keyframes stepPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(26, 115, 232, 0.2); }
    50% { box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.1); }
}

@keyframes dotPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.4); }
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-header #progress-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.pipeline-log-box {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 12px 16px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    margin-top: 12px;
}

.log-entry {
    display: flex;
    gap: 12px;
    padding: 3px 0;
    color: #a0aec0;
    line-height: 1.5;
}

.log-time {
    color: #63b3ed;
    flex-shrink: 0;
    font-weight: 600;
}

.log-msg {
    color: #e2e8f0;
    word-break: break-all;
}
