:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #242836;
    --border: #2e3345;
    --text: #e4e6ed;
    --text-dim: #8b8fa3;
    --accent: #6c5ce7;
    --accent-hover: #7c6ef7;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
}

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

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

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.container.wide { max-width: 960px; }

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

.header h1 {
    font-size: 1.4rem;
    font-weight: 600;
}

.header-links { display: flex; gap: 1rem; align-items: center; }
.header-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.85rem;
}
.header-links a:hover { color: var(--text); }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

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

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

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: #fff;
}

.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); font-size: 0.8rem; padding: 0.4rem 0.8rem; }
.btn-danger:hover { background: #c0392b; }
.btn-sm { font-size: 0.8rem; padding: 0.35rem 0.7rem; }
.btn-block { width: 100%; text-align: center; }

/* Flash messages */
.flash {
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.flash.error { background: rgba(231, 76, 60, 0.15); border: 1px solid var(--danger); color: #e74c3c; }
.flash.success { background: rgba(39, 174, 96, 0.15); border: 1px solid var(--success); color: #27ae60; }

/* File input */
.file-input-wrap {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-input-wrap:hover { border-color: var(--accent); }

.file-input-wrap input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-input-wrap .file-label {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.file-input-wrap .file-name {
    color: var(--accent);
    font-weight: 500;
    margin-top: 0.3rem;
    display: none;
}

/* Users table */
.user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.user-table th {
    text-align: left;
    padding: 0.5rem;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}

.user-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.user-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* Login page centering */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 2rem;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 0.3rem;
    font-size: 1.5rem;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

/* Progress bar */
.upload-progress {
    display: none;
    margin-top: 1rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--surface2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.3s;
    border-radius: 3px;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 0.4rem;
    text-align: center;
}

/* Edit modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    width: 90%;
    max-width: 420px;
}

.modal h3 { margin-bottom: 1rem; }
.modal .btn-row { display: flex; gap: 0.5rem; margin-top: 1rem; }

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
    .container { padding: 1rem; }
}
