* { box-sizing: border-box; }
:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --ok: #047857;
    --shadow: 0 12px 28px rgba(15, 23, 42, .08);
}
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: .8rem 1.2rem;
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}
.brand {
    font-weight: 800;
    color: var(--text);
    margin-right: 1rem;
}
nav {
    display: inline-flex;
    gap: .7rem;
    flex-wrap: wrap;
}
nav a, .userbox a {
    color: var(--muted);
    font-weight: 600;
}
.userbox {
    display: flex;
    align-items: center;
    gap: .8rem;
    white-space: nowrap;
}
.container {
    width: min(1480px, calc(100vw - 2rem));
    margin: 1.4rem auto 3rem;
}
h1 { margin: 0 0 1.2rem; font-size: clamp(1.6rem, 2.5vw, 2.4rem); }
h2 { margin: 0 0 1rem; font-size: 1.1rem; }
.card, .kpi {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.card { padding: 1rem; margin-bottom: 1rem; }
.card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.kpi { padding: 1rem; }
.kpi span { color: var(--muted); display: block; margin-bottom: .3rem; }
.kpi strong { font-size: 2rem; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
label {
    display: grid;
    gap: .35rem;
    font-weight: 700;
    color: #374151;
}
input, select, textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: .75rem .8rem;
    font: inherit;
    background: #fff;
    color: var(--text);
}
textarea { resize: vertical; }
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: .75rem 1rem;
    font-weight: 800;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
}
button:hover, .button:hover { background: var(--primary-dark); text-decoration: none; }
.button.light {
    background: #eef2ff;
    color: #1d4ed8;
}
.button.light:hover { background: #dbeafe; }
button.danger {
    background: #fee2e2;
    color: var(--danger);
}
button.danger:hover { background: #fecaca; }
.login-card { max-width: 440px; }
.hint {
    color: var(--muted);
    font-size: .92rem;
}
.flash {
    padding: .9rem 1rem;
    border-radius: 14px;
    margin-bottom: 1rem;
    background: #ecfdf5;
    color: var(--ok);
    border: 1px solid #bbf7d0;
}
.flash.error {
    background: #fef2f2;
    color: var(--danger);
    border-color: #fecaca;
}
.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) repeat(4, minmax(170px, 1fr));
    gap: .8rem;
    align-items: end;
}
.filter-actions {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    grid-column: 1 / -1;
}
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}
th, td {
    border-bottom: 1px solid var(--line);
    padding: .65rem .55rem;
    vertical-align: top;
    text-align: left;
}
th {
    color: #4b5563;
    background: #f9fafb;
    position: sticky;
    top: 0;
}
.badge {
    display: inline-flex;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 999px;
    padding: .15rem .5rem;
    font-weight: 800;
}
.edit-form { display: grid; gap: 1rem; }
.actions {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
}
details {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: .8rem;
    background: #fbfdff;
}
summary {
    cursor: pointer;
    font-weight: 900;
}
.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: .6rem;
    margin-top: .8rem;
}
.check-card {
    display: flex;
    gap: .5rem;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .55rem;
    background: #fff;
    font-weight: 600;
}
.check-card input { width: auto; }
.check-card small {
    margin-left: auto;
    color: var(--muted);
    font-weight: 900;
}
.competence-list {
    display: grid;
    gap: .45rem;
    margin-top: .8rem;
    max-height: 560px;
    overflow: auto;
}
.competence-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 70px;
    gap: .6rem;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: .45rem;
    background: #fff;
    font-weight: 500;
}
.competence-row input[type="checkbox"] { width: auto; }
.competence-row .mark { padding: .4rem; text-align: center; }
.tabs {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.tabs a {
    padding: .65rem .9rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--muted);
    font-weight: 800;
}
.tabs a.active {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}
@media (max-width: 1000px) {
    .grid.two, .grid.four, .filters, .kpi-grid { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; flex-direction: column; }
}
