:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-strong: #f8fafc;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #e74c3c;
    --primary-dark: #c0392b;
    --secondary: #2e86de;
    --border: rgba(15, 23, 42, 0.08);
    --shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at top left, rgba(231, 76, 60, 0.08), transparent 25%),
                radial-gradient(circle at bottom right, rgba(46, 134, 222, 0.08), transparent 20%),
                var(--bg);
    color: var(--text);
    min-height: 100vh;
}

button, input, select, textarea {
    font-family: inherit;
}

button {
    cursor: pointer;
}

/* Login */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at top, rgba(46, 134, 222, 0.18), transparent 35%),
                linear-gradient(135deg, #1e293b, #111827);
}
.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}
.login-card {
    background: rgba(255,255,255,0.98);
    border-radius: 28px;
    padding: 2.2rem;
    box-shadow: 0 28px 80px rgba(15,23,42,0.18);
    text-align: center;
    border: 1px solid rgba(15,23,42,0.08);
}
.login-card .logo {
    display: grid;
    place-items: center;
    gap: 0.8rem;
}
.login-card .logo img.login-logo {
    width: 82px;
    height: auto;
    border-radius: 16px;
    border: 2px solid rgba(231,76,60,0.14);
    padding: 0.4rem;
    background: white;
}
.login-card .logo h1 {
    color: var(--primary);
    margin-bottom: 0.3rem;
    font-size: 2rem;
}
.login-card .logo p {
    color: var(--muted);
    margin-bottom: 1.5rem;
}
.form-group {
    margin-bottom: 1rem;
    text-align: left;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text);
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(15,23,42,0.12);
    border-radius: 18px;
    font-size: 1rem;
    background: #ffffff;
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: rgba(231, 76, 60, 0.6);
    box-shadow: 0 0 0 6px rgba(231, 76, 60, 0.08);
    outline: none;
}
.btn-primary, button[type="submit"] {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.95rem 1.5rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 12px 30px rgba(231, 76, 60, 0.18);
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(231, 76, 60, 0.2);
}
.btn-secondary {
    background: #ffffff;
    border: 1px solid rgba(15,23,42,0.12);
    color: var(--text);
    padding: 0.85rem 1.4rem;
    border-radius: 999px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}
.btn-secondary:hover {
    background: #f8fafc;
    transform: translateY(-1px);
}
.btn-edit, .btn-delete, .btn-attestation {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
    border: none;
}
.btn-edit {
    background: #3792f1;
    color: white;
}
.btn-edit:hover { background: #2479d9; transform: translateY(-1px); }
.btn-delete {
    background: #f26b3f;
    color: white;
}
.btn-delete:hover { background: #d04f24; transform: translateY(-1px); }
.btn-attestation {
    background: #27ae60;
    color: white;
}
.btn-attestation:hover { background: #1f8f4b; transform: translateY(-1px); }
.alert {
    padding: 1rem 1.1rem;
    margin: 1rem 0;
    border-radius: 18px;
    font-size: 0.96rem;
    line-height: 1.5;
    box-shadow: inset 0 0 0 1px rgba(15,23,42,0.04);
}
.success { background: #e9f8ee; color: #1d6d3b; }
.error { background: #fdecea; color: #a61b1b; }
.info { background: #e6f0fb; color: #1d4f91; }

/* Application layout */
.app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1.6rem 2rem;
}
header {
    background: rgba(255,255,255,0.98);
    border-radius: 28px;
    padding: 1rem 1.4rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 18px 45px rgba(15,23,42,0.08);
    border: 1px solid rgba(15,23,42,0.06);
}
header .logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}
header .logo a {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.9rem;
}
header .logo img.site-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(15,23,42,0.08);
    background: white;
}
header .logo h1 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--text);
}
.brand-meta {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.95rem;
    color: var(--muted);
}
.user-greeting {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.8rem;
    background: rgba(15,23,42,0.04);
    border-radius: 999px;
}
.role-badge {
    background: var(--primary);
    color: white;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}
nav a {
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    padding: 0.8rem 1rem;
    border-radius: 999px;
    background: rgba(231,76,60,0.08);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
nav a:hover {
    background: rgba(231,76,60,0.16);
    color: var(--primary-dark);
    transform: translateY(-1px);
}
nav a.active {
    background: var(--primary);
    color: white;
}
.main-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin: 0.5rem 0;
}
.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: center;
}
.header-actions a {
    text-decoration: none;
    color: var(--text);
    padding: 0.75rem 1rem;
    border-radius: 999px;
    background: rgba(15,23,42,0.05);
    transition: background 0.2s ease, transform 0.2s ease;
}
.header-actions a.active {
    background: rgba(231,76,60,0.14);
    color: var(--primary-dark);
}
.header-actions a:hover {
    transform: translateY(-1px);
}
.page-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-top h1 {
    font-size: 2rem;
    margin: 0;
    letter-spacing: -0.03em;
}
.page-top a {
    color: var(--text);
}
.page-top a:hover {
    color: var(--primary);
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 18px 40px rgba(15,23,42,0.06);
    border: 1px solid rgba(15,23,42,0.05);
}
.stat-card h3 {
    font-size: 1rem;
    margin-bottom: 0.6rem;
    color: var(--muted);
}
.stat-card .big-number {
    font-size: 2.3rem;
    font-weight: 800;
    color: var(--primary);
}
.widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}
.card {
    background: var(--surface);
    border-radius: 28px;
    padding: 1.8rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 14px 35px rgba(15,23,42,0.06);
    border: 1px solid rgba(15,23,42,0.05);
}
.card h3 {
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary);
    padding-left: 0.9rem;
    color: var(--text);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    min-width: 600px;
}
.data-table th, .data-table td {
    border: 1px solid rgba(15,23,42,0.08);
    padding: 1rem;
    text-align: left;
    vertical-align: middle;
}
.data-table th {
    background: #f8fafc;
    color: var(--muted);
    font-weight: 700;
}
.data-table tbody tr {
    transition: background 0.2s ease;
}
.data-table tbody tr:hover {
    background: rgba(231,76,60,0.05);
}
.table-responsive {
    overflow-x: auto;
    border: 1px solid rgba(15,23,42,0.08);
    border-radius: 22px;
}
.form-inline {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}
.form-inline > * {
    min-width: 180px;
    flex: 1;
}
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
    width: 100%;
}
.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
@media (max-width: 900px) {
    .app { padding: 1rem; }
    header { padding: 1rem; }
    .page-top h1 { font-size: 1.6rem; }
    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }
    .main-header nav, .header-actions {
        width: 100%;
    }
}
@media (max-width: 640px) {
    .card, .login-card { padding: 1.4rem; }
    .table-responsive {
        border-radius: 18px;
    }
    .data-table {
        min-width: 100%;
    }
    nav a {
        flex: 1 1 100%;
    }
}