:root {
    --indigo: #4f46e5;
    --indigo-dark: #4338ca;
    --bg: #f5f6fb;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --text: #1f2330;
    --text-muted: #6b7280;
    --green-bg: #dcfce7;
    --green-text: #166534;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { text-decoration: none; color: inherit; }

/* ---------- Login / Register ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
    width: 100%;
    max-width: 380px;
}
.auth-card h1 {
    color: var(--indigo);
    margin: 0 0 4px;
    font-size: 26px;
}
.auth-card p.subtitle {
    margin: 0 0 24px;
    color: var(--text-muted);
    font-size: 14px;
}
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--text-muted); }
input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}
.btn {
    display: inline-block;
    background: var(--indigo);
    color: #fff;
    border: none;
    padding: 11px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn:hover { background: var(--indigo-dark); }
.btn-secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-block { width: 100%; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 14px; color: var(--text-muted); }
.auth-foot a { color: var(--indigo); font-weight: 600; }
.error-msg { background: #fee2e2; color: #991b1b; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.success-msg { background: var(--green-bg); color: var(--green-text); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 230px;
    background: #fff;
    border-right: 1px solid var(--border);
    padding: 28px 20px;
    flex-shrink: 0;
}
.sidebar .brand { color: var(--indigo); font-size: 24px; font-weight: 800; margin-bottom: 30px; }
.sidebar nav { display: flex; flex-direction: column; gap: 6px; }
.nav-link { padding: 10px 14px; border-radius: 8px; color: var(--text); font-size: 15px; }
.nav-link:hover { background: #f3f2ff; }
.nav-link.active { background: #eceafd; color: var(--indigo); font-weight: 600; }

.main { flex: 1; display: flex; flex-direction: column; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}
.topbar h1 { margin: 0; font-size: 24px; }
.topbar-right { display: flex; align-items: center; gap: 18px; font-size: 14px; color: var(--text-muted); }
.topbar-right a { color: var(--indigo); font-weight: 600; }

.content { padding: 28px 32px; }

/* ---------- Dashboard cards ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: #ede9fe;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
}
.stat-card .stat-label { color: var(--text-muted); font-size: 14px; margin-bottom: 4px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }

.panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.panel h2 { margin: 0 0 16px; font-size: 19px; }
.stage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; }
.stage-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 0; border-bottom: 1px solid var(--border);
}
.stage-row:last-child { border-bottom: none; }
.stage-row .stage-name { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.stage-row .stage-count { font-weight: 700; font-size: 17px; }

/* ---------- Tables ---------- */
.table-toolbar {
    display: flex; justify-content: flex-end; gap: 12px; margin-bottom: 16px;
}
.search-input { max-width: 260px; }
table.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 14px;
}
table.data-table th {
    background: #f3f4f6;
    text-align: left;
    padding: 12px 14px;
    font-weight: 700;
    white-space: nowrap;
}
table.data-table td {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    white-space: nowrap;
}
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-delivered, .badge-completed { background: var(--green-bg); color: var(--green-text); }
.badge-scripting, .badge-onboarding { background: #fef3c7; color: #92400e; }
.badge-shooting { background: #dbeafe; color: #1e40af; }
.badge-editing { background: #ede9fe; color: #5b21b6; }
.action-link { font-weight: 600; margin-right: 10px; }
.action-link.delete { color: #dc2626; }
.action-link.edit { color: var(--indigo); }
.empty-row td { text-align: center; color: var(--text-muted); padding: 30px; }

/* ---------- Form ---------- */
.form-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    max-width: 900px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px 24px;
}
.form-actions {
    display: flex; justify-content: flex-end; gap: 12px; margin-top: 26px;
}
@media (max-width: 800px) {
    .form-grid { grid-template-columns: 1fr; }
    .stage-grid { grid-template-columns: 1fr; }
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; }
}
