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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
}

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

.hidden { display: none !important; }

/* Login */
.login-container {
    max-width: 360px;
    margin: 100px auto;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

#login-form input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
}

#login-form button {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

#login-form button:hover {
    background: var(--primary-dark);
}

.error {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Navigation */
nav {
    background: var(--primary);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav h1 { font-size: 1.5rem; }

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

#logout-btn {
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#logout-btn:hover {
    background: rgba(255,255,255,0.3);
}

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

.sidebar {
    width: 220px;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    padding: 1rem 0;
}

.sidebar ul { list-style: none; }

.sidebar a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text);
    text-decoration: none;
}

.sidebar a:hover, .sidebar a.active {
    background: var(--bg);
    color: var(--primary);
}

main {
    flex: 1;
    padding: 2rem;
}

.section h2 {
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn-primary {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 1rem;
}

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

.btn-danger {
    padding: 0.25rem 0.5rem;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn-secondary {
    padding: 0.25rem 0.5rem;
    background: var(--text-light);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
}

/* Lists */
.list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.list-item {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-item-info h4 { margin-bottom: 0.25rem; }
.list-item-info p { color: var(--text-light); font-size: 0.875rem; }

.list-item-actions {
    display: flex;
    gap: 0.5rem;
}

/* Forms */
.form-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    max-width: 400px;
}

.form-card input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.form-card button {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.message { margin-top: 1rem; }
.message.success { color: var(--success); }
.message.error { color: var(--danger); }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--card-bg);
    border-radius: 8px;
    min-width: 400px;
    max-width: 90%;
}

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

.modal-header h3 { font-size: 1.125rem; }

#modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

#modal-content {
    padding: 1.5rem;
}

#modal-content input, #modal-content select {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

#modal-content button {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#modal-content .error {
    margin-bottom: 1rem;
}

.api-key-display {
    background: var(--bg);
    padding: 1rem;
    border-radius: 4px;
    font-family: monospace;
    word-break: break-all;
    margin-bottom: 1rem;
}

.api-key-warning {
    color: var(--danger);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container { flex-direction: column; }
    .sidebar { width: 100%; }
    .sidebar ul { display: flex; overflow-x: auto; }
    .sidebar a { white-space: nowrap; }
}
