* { box-sizing: border-box; }
body {
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: #f4f5f7;
    color: #1c2430;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.topbar {
    background: linear-gradient(180deg, #17294a 0%, #0f1d36 100%);
    box-shadow: 0 4px 16px rgba(8,14,28,0.22);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 64px;
    position: relative;
    z-index: 1;
}
.topbar .brand { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 800; font-family: 'Manrope', -apple-system, Segoe UI, Roboto, Arial, sans-serif; font-size: 17px; letter-spacing: -0.01em; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex-shrink: 0; display: block; }
.brand-group { display: flex; align-items: center; gap: 14px; }
.org-identity { display: flex; align-items: center; gap: 8px; color: #cfd8e6; font-size: 14px; font-weight: 600; padding-left: 14px; border-left: 1px solid rgba(255,255,255,0.14); }
.org-logo { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; background: #fff; padding: 2px; }
.topbar nav { display: flex; align-items: center; gap: 6px; }
.topbar nav a { color: #a9b4c9; text-decoration: none; font-size: 13.5px; font-weight: 600; padding: 7px 14px; border-radius: 7px; }
.topbar nav a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.topbar nav a.active { color: #fff; font-weight: 700; background: rgba(255,255,255,0.1); }
.topbar nav a.active:hover { background: rgba(255,255,255,0.1); }
/* .topbar nav a[href$="/templates.php"], .topbar nav a[href$="/my_forms.php"] { display: none; } */
.topbar .nav-divider { width: 1px; height: 18px; background: rgba(255,255,255,0.14); margin: 0 8px; }
.profile-menu { position: relative; }
.profile-menu summary { list-style: none; cursor: pointer; border-radius: 8px; padding: 4px 8px; }
.profile-menu summary::-webkit-details-marker { display: none; }
.profile-menu summary:hover, .profile-menu[open] summary { background: rgba(255,255,255,0.08); }
.who-caret { color: #8fa2c0; margin-left: 2px; }
.profile-dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 180px;
    background: #fff; border: 1px solid #e1e5ec; border-radius: 10px; padding: 6px;
    box-shadow: 0 8px 24px rgba(8,14,28,0.18);
}
.topbar nav .profile-dropdown a { display: block; margin: 0; padding: 9px 12px; border-radius: 6px; color: #22293a; font-size: 13.5px; font-weight: 600; }
.topbar nav .profile-dropdown a:hover { background: #f4f5f7; color: #12213a; }
.who-chip { display: flex; align-items: center; gap: 8px; }
.who-avatar { width: 26px; height: 26px; border-radius: 50%; background: #2f8fe0; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; font-family: 'Manrope', sans-serif; flex-shrink: 0; }
.topbar .who { color: #cfd8e6; font-size: 13px; font-weight: 600; }

main.container { flex: 1 0 auto; width: 100%; }
.site-footer {
    flex-shrink: 0;
    text-align: center;
    padding: 18px 24px;
    color: #9aa4b6;
    font-size: 12px;
    border-top: 1px solid #e1e5ec;
    background: #fff;
}

.container { max-width: 1000px; margin: 0 auto; padding: 24px; }
.container:has(.review-layout) { max-width: 1160px; }

.review-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
.review-sidebar { position: sticky; top: 20px; }
.summary-card h2 { margin-bottom: 14px; }
.overall-score { text-align: center; padding: 14px 0 18px; border-bottom: 1px solid #eceff4; margin-bottom: 12px; }
.score-donut { display: block; margin: 0 auto; }
.summary-list { list-style: none; margin: 0; padding: 0; }
.summary-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f2f6; font-size: 13px; }
.summary-list li:last-child { border-bottom: none; }
.summary-label { color: #44506a; font-size: 13px; }
.summary-value { font-weight: 600; color: #12213a; white-space: nowrap; font-size: 13px; }

.summary-row { margin-bottom: 12px; }
.summary-row-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.summary-bar { height: 5px; border-radius: 3px; background: #eceff4; overflow: hidden; }
.summary-bar-fill { height: 100%; border-radius: 3px; background: #2f8fe0; }

.rating-pill { display: inline-block; color: #fff; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }

@media (max-width: 860px) {
    .review-layout { grid-template-columns: 1fr; }
    .review-sidebar { position: static; }
}

h1, h2 { font-family: 'Manrope', -apple-system, Segoe UI, Roboto, Arial, sans-serif; letter-spacing: -0.01em; }
h1 { font-size: 23px; font-weight: 800; margin: 0 0 16px; color: #12213a; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 6px; color: #12213a; }

.card {
    background: #fff;
    border: 1px solid #e7e9ef;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(18,33,58,0.04);
}

.flash {
    background: #e6f4ea;
    border: 1px solid #b7e0c3;
    color: #1e6b34;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
}
.error {
    background: #fdecea;
    border: 1px solid #f3b9b3;
    color: #a3241a;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #44506a; }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #cdd4e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
textarea { min-height: 70px; resize: vertical; }

.btn {
    display: inline-block;
    background: #2f8fe0;
    color: #fff;
    border: none;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #2578c2; }
.btn.secondary { background: #eef1f6; color: #33405c; }
.btn.secondary:hover { background: #dfe4ee; }
.btn.danger { background: #e04f4f; }
.btn.danger:hover { background: #c73f3f; }
.btn.small { padding: 5px 12px; font-size: 13px; }

.legend { border: 1px solid #e1e5ec; border-radius: 8px; padding: 16px 20px; margin-bottom: 20px; background: #fafbfc; }
.legend h3 { margin: 0 0 8px; font-size: 14px; letter-spacing: .03em; }
.legend ol { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.6; }
.legend ol li .score-dot { margin-right: 2px; }

.section-block { margin-bottom: 28px; }
.section-block .desc { color: #5b6478; font-size: 14px; margin-bottom: 10px; }

table.entries { width: 100%; border-collapse: collapse; background: #fff; }
table.entries th {
    background: #12213a;
    color: #fff;
    text-align: left;
    padding: 10px 12px;
    font-size: 13px;
}
table.entries td {
    padding: 10px 12px;
    border-bottom: 1px solid #eceff4;
    font-size: 14px;
    vertical-align: top;
}
table.entries td.actions { white-space: nowrap; text-align: right; }
table.entries td.actions a { margin-left: 10px; font-size: 13px; text-decoration: none; }
table.entries td.actions a.edit { color: #2f8fe0; }
table.entries td.actions a.delete { color: #e04f4f; }

.avg-line { margin-top: 8px; font-size: 14px; color: #33405c; }
.avg-line strong { font-size: 16px; }

.list-table { width: 100%; border-collapse: collapse; }
.list-table th, .list-table td { padding: 10px 8px; border-bottom: 1px solid #eceff4; text-align: left; font-size: 14px; }
.list-table th { color: #5b6478; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }

.top-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

.org-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border: 1px solid #e1e5ec;
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 20px;
}
.org-banner-logo { width: 52px; height: 52px; object-fit: contain; border-radius: 8px; }
.org-banner-logo-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: #12213a; color: #fff; font-weight: 700; font-size: 22px;
}
.org-banner-name { margin: 0; font-size: 20px; }

.muted { color: #7c8598; font-size: 13px; }
.field-type-badge { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; background: #eef1f6; color: #44506a; padding: 2px 8px; border-radius: 10px; margin-left: 8px; }

.rt-link { color: #2f8fe0; text-decoration: none; }
.rt-link:hover { color: #1c5cab; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
.stat-tile { background: #fff; border: 1px solid #e7e9ef; border-radius: 12px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(18,33,58,0.04); display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.stat-tile .score-donut { flex-shrink: 0; }
.stat-value { font-family: 'Manrope', sans-serif; font-size: 21px; font-weight: 800; color: #12213a; line-height: 1.1; }
.stat-label { font-size: 12px; color: #7c8598; margin-top: 2px; font-weight: 600; }

.dash-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; align-items: start; }
.dash-side { display: flex; flex-direction: column; gap: 16px; }

.score-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.review-list td { vertical-align: middle; }

.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f4f5f8; }
.alert-list li:last-child { border-bottom: none; }
.alert-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.alert-title { font-size: 13px; font-weight: 600; color: #22293a; }
.alert-subtitle { font-size: 11.5px; color: #98a1b3; margin-top: 1px; }

@media (max-width: 980px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .dash-grid { grid-template-columns: 1fr; }
}

.staff-group { margin-bottom: 22px; }
.staff-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12.5px; font-weight: 700; color: #44506a; text-transform: uppercase; letter-spacing: .04em; }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.staff-card { background: #fff; border: 1px solid #e7e9ef; border-radius: 12px; padding: 16px; box-shadow: 0 1px 2px rgba(18,33,58,0.04); display: flex; flex-direction: column; gap: 10px; }
.staff-card:hover { box-shadow: 0 4px 14px rgba(18,33,58,0.08); border-color: #d7dfec; }
.staff-card-top { display: flex; align-items: center; gap: 10px; }
.staff-card-id { min-width: 0; }
.staff-card-name { font-size: 13.5px; font-weight: 700; color: #12213a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staff-card-title { font-size: 11.5px; color: #7c8598; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staff-card-bottom { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid #f0f2f6; }
.staff-card-dept { font-size: 11px; color: #98a1b3; font-weight: 600; }
.staff-card .row-actions { gap: 6px; }
.staff-card .btn.small { padding: 5px 10px; font-size: 12px; }

.auth-card { max-width: 420px; margin: 60px auto 0; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.reset-password-details { position: relative; }
.reset-password-details summary { list-style: none; cursor: pointer; }
.reset-password-details summary::-webkit-details-marker { display: none; }
.reset-password-form {
    position: absolute; z-index: 10; top: calc(100% + 4px); left: 0;
    background: #fff; border: 1px solid #e1e5ec; border-radius: 8px;
    padding: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex; gap: 6px; white-space: nowrap;
}
.reset-password-form input[type=password] { width: 160px; }
