:root {
  --green-950: #063d25;
  --green-900: #084d2d;
  --green-800: #0b5d35;
  --green-700: #137744;
  --green-600: #1b9252;
  --green-100: #dceee3;
  --green-50: #eff7f2;
  --ink: #17211b;
  --muted: #647168;
  --line: #dfe7e1;
  --surface: #ffffff;
  --canvas: #f3f6f4;
  --amber: #e6a21a;
  --amber-bg: #fff5dc;
  --red: #c93737;
  --red-bg: #fff0f0;
  --blue: #2878b9;
  --radius: 6px;
  --shadow: 0 8px 24px rgba(13, 55, 33, 0.08);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 14px; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
a { color: inherit; }
.icon { width: 20px; height: 20px; flex: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--green-950); color: #fff; padding: 20px 14px 16px; z-index: 40; }
.brand { display: flex; align-items: center; min-height: 68px; padding: 5px 10px 20px; border-bottom: 1px solid rgba(255,255,255,.13); }
.brand img { display: block; width: 100%; height: 52px; object-fit: contain; background: #fff; border-radius: 4px; padding: 5px 7px; }
.main-nav { display: grid; gap: 5px; margin-top: 24px; }
.main-nav a, .logout-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 13px; color: rgba(255,255,255,.76); text-decoration: none; border-radius: 5px; font-weight: 650; }
.main-nav a:hover, .logout-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.main-nav a.active { background: #fff; color: var(--green-900); box-shadow: 0 5px 14px rgba(0,0,0,.12); }
.sidebar-user { margin-top: auto; display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: center; padding: 15px 10px; border-top: 1px solid rgba(255,255,255,.13); }
.sidebar-user strong, .sidebar-user small { display: block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { margin-top: 2px; color: rgba(255,255,255,.62); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--green-100); color: var(--green-900); }
.avatar .icon { width: 18px; }
.avatar-image { width: 38px; height: 38px; flex: none; border: 2px solid rgba(255,255,255,.72); border-radius: 50%; object-fit: cover; background: #fff; }
.logout-link { margin-top: 3px; }
.profile-menu { position: relative; }
.sidebar-profile { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.13); }
.profile-trigger { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 0; border-radius: 5px; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.profile-trigger:hover { background: rgba(255,255,255,.08); }
.profile-trigger > span:not(.avatar):not(.profile-name) { min-width: 0; }
.profile-trigger strong, .profile-trigger small { display: block; max-width: 135px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-trigger small { margin-top: 2px; color: rgba(255,255,255,.62); }
.profile-trigger > .icon:last-child { width: 16px; margin-left: auto; transition: transform .15s ease; }
.profile-menu.open .profile-trigger > .icon:last-child { transform: rotate(90deg); }
.profile-dropdown { position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 70; display: none; width: 230px; overflow: hidden; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 16px 34px rgba(3,31,17,.22); }
.profile-menu.open .profile-dropdown { display: block; }
.profile-dropdown.align-right { right: 0; bottom: auto; left: auto; top: calc(100% + 8px); }
.profile-summary { padding: 13px 14px; border-bottom: 1px solid var(--line); }
.profile-summary strong, .profile-summary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-summary small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.profile-dropdown a { min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 9px 13px; color: #334138; text-decoration: none; font-size: 13px; font-weight: 680; }
.profile-dropdown a:hover { background: var(--green-50); color: var(--green-900); }
.profile-dropdown a .icon { width: 17px; }
.profile-dropdown a.danger-link { color: var(--red); border-top: 1px solid var(--line); }
.sidebar-scrim { display: none; }

.app-main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; min-height: 78px; display: flex; align-items: center; gap: 15px; padding: 12px clamp(18px, 3vw, 38px); background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 1px 0 0; font-size: 21px; line-height: 1.2; letter-spacing: 0; }
.eyebrow { margin: 0; font-size: 10px; font-weight: 800; color: var(--green-700); letter-spacing: .08em; }
.topbar-menu-link { position: absolute; left: 50%; min-height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--green-100); border-radius: 5px; color: var(--green-900); background: var(--green-50); text-decoration: none; font-weight: 750; transform: translateX(-50%); }
.topbar-menu-link:hover { border-color: #b6d6c2; background: #e5f3ea; }
.topbar-menu-link .icon { width: 18px; }
.topbar-user { margin-left: auto; font-weight: 700; color: var(--green-900); }
.topbar-user .profile-trigger { width: auto; min-height: 48px; padding-left: 12px; border: 1px solid transparent; }
.topbar-user .profile-trigger:hover { background: var(--green-50); border-color: var(--green-100); }
.topbar-user .profile-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user .profile-trigger > .icon:last-child { color: var(--muted); }
.icon-button { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; color: var(--green-900); background: #fff; cursor: pointer; }
.menu-toggle { display: none; }
.page-content { width: min(1540px, 100%); margin: 0 auto; padding: 24px clamp(16px, 3vw, 38px) 48px; }

.filter-bar { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 18px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.filter-bar label { display: grid; gap: 5px; min-width: 155px; }
.filter-bar label:first-child { min-width: 240px; }
label > span, .field-label { color: #465249; font-size: 12px; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 40px; border: 1px solid #cbd6ce; border-radius: 5px; background: #fff; color: var(--ink); padding: 8px 11px; outline: none; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; padding: 0; accent-color: var(--green-700); }
textarea { min-height: 92px; resize: vertical; }
label small { color: var(--muted); font-size: 11px; line-height: 1.4; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(27,146,82,.18); outline: none; }

.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border: 1px solid var(--green-800); border-radius: 5px; background: var(--green-800); color: #fff; text-decoration: none; font-weight: 750; cursor: pointer; }
.button:hover { background: var(--green-950); }
.button.secondary { color: var(--green-900); background: #fff; }
.button.secondary:hover { background: var(--green-50); }
.button.danger { border-color: var(--red); background: var(--red); }
.button.small { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.button .icon { width: 17px; height: 17px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; }
.dashboard-main { min-width: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { min-height: 108px; padding: 17px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 12px rgba(13,55,33,.04); }
.kpi p { margin: 0 0 10px; color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; }
.kpi strong { display: block; color: var(--green-900); font-size: 27px; line-height: 1; }
.kpi small { display: block; margin-top: 8px; color: var(--muted); }
.kpi.warning strong { color: var(--amber); }
.kpi.danger strong { color: var(--red); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 14px rgba(13,55,33,.04); }
.panel + .panel { margin-top: 16px; }
.panel-header { min-height: 62px; display: flex; align-items: center; gap: 14px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.panel-header > div:first-child { min-width: 0; }
.panel-header h2 { margin: 0; font-size: 16px; letter-spacing: 0; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.panel-header .panel-actions { margin-left: auto; display: flex; gap: 9px; align-items: center; }
.panel-body { padding: 17px; }

.weights { display: grid; grid-template-columns: 45fr 5fr 20fr 20fr 5fr 5fr; min-height: 62px; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; }
.weights div { min-width: 0; display: grid; place-items: center; align-content: center; gap: 3px; padding: 7px 5px; border-right: 1px solid rgba(255,255,255,.65); color: #fff; background: var(--green-800); text-align: center; }
.weights div:nth-child(2) { background: var(--amber); color: #332300; }
.weights div:nth-child(3), .weights div:nth-child(4) { background: #2f7e5d; }
.weights div:nth-child(5), .weights div:nth-child(6) { background: #557163; }
.weights span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 10px; font-weight: 700; white-space: nowrap; }
.weights strong { font-size: 15px; }

.table-wrap { max-width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 11px 12px; color: #4d5a51; background: #f4f7f5; border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 12px; border-bottom: 1px solid #edf1ee; vertical-align: middle; }
.data-table tbody tr:hover { background: #f8fbf9; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.rank { width: 42px; color: var(--green-800); font-weight: 850; }
.person-cell { min-width: 220px; }
.person-cell strong, .person-cell small { display: block; }
.person-cell small { margin-top: 3px; color: var(--muted); }
.score { color: var(--green-900); font-size: 16px; font-weight: 850; font-variant-numeric: tabular-nums; }
.score.low { color: var(--red); }
.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 25px; padding: 4px 8px; border-radius: 999px; color: var(--green-900); background: var(--green-100); font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge.warning { color: #735000; background: var(--amber-bg); }
.badge.danger { color: #8d2323; background: var(--red-bg); }
.badge.neutral { color: #536057; background: #edf1ee; }

.alert-list { display: grid; gap: 10px; }
.alert-item { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 12px; border: 1px solid #f0d7a1; border-radius: 5px; background: var(--amber-bg); }
.alert-item.danger { border-color: #edc1c1; background: var(--red-bg); }
.alert-item .icon { width: 18px; color: #936500; }
.alert-item.danger .icon { color: var(--red); }
.alert-item strong, .alert-item small { display: block; }
.alert-item small { margin-top: 3px; color: var(--muted); line-height: 1.4; }
.progress-row { margin-top: 15px; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 12px; font-weight: 750; }
.progress { height: 8px; overflow: hidden; border-radius: 4px; background: #e8eee9; }
.progress > span { display: block; height: 100%; background: var(--green-600); }

.page-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.search-control { position: relative; width: min(360px, 100%); }
.search-control .icon { position: absolute; left: 11px; top: 10px; width: 18px; color: var(--muted); }
.search-control input { padding-left: 38px; }
.page-toolbar .button { margin-left: auto; }
.page-toolbar .export-button + .export-button { margin-left: 0; }
.directory-photo, .directory-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.directory-photo { display: block; border: 1px solid var(--line); background: #fff; }
.sheet-tabs { display: flex; gap: 4px; max-width: 100%; margin: 0 0 16px; padding: 6px; overflow-x: auto; background: #3f4541; border-radius: 5px; scrollbar-width: thin; }
.sheet-tabs a { flex: none; min-height: 34px; display: inline-flex; align-items: center; padding: 7px 13px; color: #fff; border: 1px solid transparent; border-radius: 3px; text-decoration: none; font-size: 12px; font-weight: 750; white-space: nowrap; }
.sheet-tabs a:hover { background: rgba(255,255,255,.12); }
.sheet-tabs a.active { color: var(--green-950); background: #fff; border-color: #cfe1d5; }
.workbook-panel { overflow: hidden; }
.workbook-heading { min-height: 124px; display: grid; grid-template-columns: 120px minmax(0, 1fr) 120px; align-items: center; gap: 20px; padding: 18px 26px 0; text-align: center; background: #fff; }
.workbook-heading::after { content: ""; width: 82px; height: 72px; justify-self: center; background: url('../logos/logo_MANAGEMENT.png') center / contain no-repeat; }
.workbook-heading img { width: 92px; height: 72px; object-fit: contain; justify-self: center; }
.workbook-heading p { margin: 0; font-size: 20px; font-weight: 850; }
.workbook-heading small { display: block; margin-top: 3px; font-weight: 750; font-style: italic; }
.workbook-heading h2 { margin: 15px 0 0; padding: 9px 12px; color: #173d27; background: #cde4be; border: 1px solid #9abb8e; font-size: 18px; letter-spacing: 0; }
.sheet-table th { color: #183f29; background: #dceaf4; border-right: 1px solid #c8d5cd; }
.sheet-table td { border-right: 1px solid #e2e8e3; font-variant-numeric: tabular-nums; }
.sheet-table .weighted-cell { background: #d9ebcd; font-weight: 750; }
.sheet-table .blue-cell { color: #fff; background: #2365a6; }
.sheet-table .total-cell { background: #fff0bd; font-weight: 850; }
.wide-sheet { min-width: 1640px; }
.muted-value { color: #8b958e; font-size: 11px; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid label { display: grid; gap: 6px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.notice { margin-bottom: 16px; padding: 12px 14px; color: var(--green-950); background: var(--green-50); border: 1px solid #bfddca; border-radius: 5px; }
.notice.error { color: #8d2323; background: var(--red-bg); border-color: #edc1c1; }
.notice { display: flex; align-items: center; gap: 9px; }
.notice .icon { width: 18px; }
.profile-page-grid { display: grid; grid-template-columns: 310px minmax(0, 760px); gap: 18px; align-items: start; }
.profile-identity-card { padding: 26px 22px; text-align: center; }
.profile-photo-wrap { display: flex; justify-content: center; margin-bottom: 16px; }
.profile-photo-large { width: 118px; height: 118px; display: grid; place-items: center; object-fit: cover; border: 4px solid #fff; border-radius: 50%; background: var(--green-50); box-shadow: 0 0 0 1px var(--line), 0 8px 22px rgba(13,55,33,.12); }
.profile-photo-placeholder { color: var(--green-800); }
.profile-photo-placeholder .icon { width: 46px; height: 46px; }
.profile-identity-card h2 { margin: 0; color: var(--green-950); font-size: 20px; }
.profile-identity-card > p { margin: 6px 0 22px; color: var(--muted); overflow-wrap: anywhere; }
.profile-details { margin: 0; border-top: 1px solid var(--line); text-align: left; }
.profile-details div { display: grid; gap: 4px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.profile-details dt { color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.profile-details dd { margin: 0; font-weight: 750; overflow-wrap: anywhere; }
.profile-settings { display: grid; gap: 16px; }
.profile-settings .panel + .panel { margin-top: 0; }
.profile-form { display: grid; gap: 14px; }
.profile-form label { display: grid; gap: 6px; }
.profile-form .form-actions { margin-top: 2px; }
.empty-state { min-height: 360px; display: grid; place-items: center; align-content: center; gap: 12px; padding: 30px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.empty-state h1, .empty-state p { margin: 0; }
.empty-state p { color: var(--muted); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--green-950); }
.login-shell { width: min(980px, 100%); min-height: 570px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; background: #fff; border-radius: 8px; box-shadow: 0 30px 70px rgba(0,0,0,.26); }
.login-identity { display: flex; flex-direction: column; justify-content: space-between; padding: 48px; color: #fff; background: var(--green-800); }
.login-identity img { width: min(340px, 100%); height: 90px; object-fit: contain; background: #fff; border-radius: 6px; padding: 10px; }
.login-identity h1 { margin: 0 0 12px; font-size: 38px; line-height: 1.05; letter-spacing: 0; }
.login-identity p { max-width: 390px; margin: 0; color: rgba(255,255,255,.76); line-height: 1.6; }
.login-identity small { color: rgba(255,255,255,.6); }
.login-form { display: grid; align-content: center; padding: 54px; }
.login-form h2 { margin: 0; font-size: 28px; }
.login-form > p { margin: 9px 0 28px; color: var(--muted); line-height: 1.5; }
.login-form label { display: grid; gap: 7px; margin-bottom: 15px; }
.login-form .button { width: 100%; margin-top: 5px; }
.login-help { margin-top: 18px; color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 1120px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-side { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
  .dashboard-side .panel + .panel { margin-top: 0; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
  .topbar-user .profile-name { display: none; }
}

@media (min-width: 821px) and (max-width: 920px) {
  .topbar-title { visibility: hidden; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); width: min(285px, 86vw); transition: transform .2s ease; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 35; background: rgba(5,25,15,.55); }
  .sidebar-open .sidebar-scrim { display: block; }
  .menu-toggle { display: inline-grid; }
  .topbar-user .profile-name { display: none; }
  .page-content { padding-top: 16px; }
  .weights { grid-template-columns: repeat(3, 1fr); }
  .weights div { min-height: 56px; border-bottom: 1px solid rgba(255,255,255,.65); }
  .profile-page-grid { grid-template-columns: 1fr; }
  .profile-identity-card { display: grid; grid-template-columns: 118px minmax(0, 1fr); column-gap: 20px; text-align: left; }
  .profile-photo-wrap { grid-row: 1 / 4; margin-bottom: 0; }
  .profile-details { grid-column: 1 / -1; margin-top: 20px; }
}

@media (max-width: 620px) {
  .topbar { min-height: 68px; padding: 10px 14px; }
  .topbar h1 { font-size: 18px; }
  .topbar-title { display: none; }
  .topbar-menu-link { font-size: 12px; padding: 8px 10px; }
  .kpi-grid, .dashboard-side, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .filter-bar { align-items: stretch; }
  .filter-bar label, .filter-bar label:first-child, .filter-bar .button { width: 100%; }
  .page-toolbar { flex-wrap: wrap; }
  .page-toolbar .button { width: 100%; margin-left: 0; }
  .panel-header { align-items: flex-start; flex-direction: column; }
  .panel-header .panel-actions { margin-left: 0; width: 100%; }
  .workbook-heading { min-height: 105px; grid-template-columns: 60px minmax(0, 1fr); gap: 10px; padding: 14px 12px 0; }
  .workbook-heading::after { display: none; }
  .workbook-heading img { width: 55px; height: 55px; }
  .workbook-heading p { font-size: 14px; }
  .workbook-heading small { font-size: 10px; }
  .workbook-heading h2 { margin-top: 10px; font-size: 14px; }
  .login-page { padding: 0; background: #fff; }
  .login-shell { min-height: 100vh; display: block; border-radius: 0; box-shadow: none; }
  .login-identity { min-height: 235px; padding: 30px 24px; }
  .login-identity h1 { margin-top: 25px; font-size: 30px; }
  .login-identity small { display: none; }
  .login-form { padding: 36px 24px; }
  .profile-identity-card { display: block; text-align: center; }
  .profile-photo-wrap { margin-bottom: 16px; }
  .profile-details { margin-top: 20px; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
