:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.navbar {
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.navbar a { color: #fff; margin-left: 1.5rem; }
.navbar .brand { font-weight: 700; font-size: 1.1rem; }
.navbar .nav-links a { opacity: 0.9; font-size: 0.9rem; }
.navbar .nav-links a:hover { opacity: 1; text-decoration: none; }

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

/* Cards */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card h2 { margin-bottom: 1rem; font-size: 1.25rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.25rem; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.required::after { content: ' *'; color: var(--danger); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--gray-200); }
th { background: var(--gray-100); font-size: 0.85rem; text-transform: uppercase; color: var(--gray-500); }
tr:hover { background: var(--gray-50); }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-draft { background: var(--gray-200); color: var(--gray-700); }
.badge-review { background: #fef3c7; color: #92400e; }
.badge-finalised { background: #d1fae5; color: #065f46; }

/* Flash messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* Completeness bar */
.completeness-bar { background: var(--gray-200); border-radius: 999px; height: 8px; margin-top: 0.25rem; }
.completeness-fill { height: 100%; border-radius: 999px; background: var(--success); transition: width 0.3s; }

/* Checklist */
.checklist label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-weight: normal;
    cursor: pointer;
}
.checklist input[type="checkbox"] { margin-top: 0.25rem; }

/* Stats grid */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; padding: 1rem; text-align: center; }
.stat-card .number { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 0.8rem; color: var(--gray-500); text-transform: uppercase; }

/* Login page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
}
.login-card { background: #fff; border-radius: 12px; padding: 2.5rem; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.login-card h1 { text-align: center; margin-bottom: 1.5rem; }

/* Audit timeline */
.timeline { border-left: 2px solid var(--gray-200); margin-left: 0.5rem; padding-left: 1.5rem; }
.timeline-item { position: relative; margin-bottom: 1rem; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 0.4rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
}
.timeline-item .time { font-size: 0.8rem; color: var(--gray-500); }
.timeline-item .action { font-weight: 600; }
