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

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
    --hover: #2d3748;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text);
}

#login-form {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px var(--shadow);
}

/* Navbar */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-username {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Container */
.container {
    display: flex;
    min-height: calc(100vh - 65px);
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
}

.menu {
    list-style: none;
}

.menu-item {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-weight: 500;
}

.menu-item:hover {
    background: var(--bg);
    color: var(--text);
}

.menu-item.active {
    background: var(--primary);
    color: white;
    border-right: 3px solid var(--primary-dark);
}

/* Content */
.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

/* Card */
.card {
    background: var(--surface);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px var(--shadow);
    margin-bottom: 1.5rem;
}

/* Form */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-secondary {
    background: var(--secondary);
    color: white;
}

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

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.page-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text);
}

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

.table tr:hover {
    background: var(--bg);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.active {
    display: block;
}

.modal-content {
    background-color: var(--surface);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    position: relative;
}

.modal-large {
    max-width: 800px;
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}

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

/* Messages */
.error-message {
    color: var(--danger);
    margin-top: 1rem;
    font-size: 0.875rem;
}

.success-message {
    color: var(--success);
    margin-top: 1rem;
    font-size: 0.875rem;
}

.info-message {
    padding: 1rem;
    background: #dbeafe;
    border-left: 4px solid var(--primary);
    border-radius: 4px;
    margin-bottom: 1rem;
}

.warning-message {
    padding: 1rem;
    background: #fef3c7;
    border-left: 4px solid var(--warning);
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* Content Area */
.content-area {
    min-height: 200px;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px var(--shadow);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .menu {
        display: flex;
        overflow-x: auto;
    }

    .menu-item {
        white-space: nowrap;
    }

    .content {
        padding: 1rem;
    }

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

    .page-actions {
        flex-direction: column;
    }

    .navbar {
        flex-direction: column;
        gap: 1rem;
    }

    .modal-large {
        width: 95%;
        max-height: 95vh;
        overflow-y: auto;
    }
}

/* Links List */
.links-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.link-item {
    padding: 0.5rem;
    background: var(--bg);
    border-radius: 4px;
    word-break: break-all;
}

.link-item a {
    color: var(--primary);
    text-decoration: none;
}

.link-item a:hover {
    text-decoration: underline;
}

/* Modal sizes */
.modal-large {
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Templates grid */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.templates-grid .card {
    margin: 0;
}

.templates-grid h4 {
    margin-top: 0;
    color: var(--primary);
}

/* Status badges */
.status-stopped { color: var(--secondary); }
.status-ready_for_review { color: var(--warning); }
.status-in_review { color: var(--warning); }
.status-declined { color: var(--danger); }
.status-active { color: var(--success); }
.status-on_hold { color: var(--secondary); }

/* Disabled buttons */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

