:root {
    --text: #333333;
    --heading: #17375e;
    --heading-2: #376092;
    --blue: #4f81bd;
    --accent: #ff8d41;
    --yellow: #f5d329;
    --muted: #777777;
    --soft: #999999;
    --line: #e6e9ef;
    --line-strong: #d3d8e2;
    --canvas: #f6f7fa;
    --surface: #ffffff;
    --surface-soft: #fbfcfe;
    --success: #34c759;
    --danger: #ff6b6b;
    --shadow: 0 14px 36px rgba(23, 55, 94, .08);
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--canvas);
    color: var(--text);
    font-family: Calibri, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    letter-spacing: 0;
}
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: var(--yellow);
    z-index: 60;
}

a { color: var(--heading-2); text-decoration: none; }
a:hover { color: var(--accent); }

input, select, textarea, button {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
    color: var(--text);
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(79, 129, 189, .14);
}
textarea { resize: vertical; margin-top: 12px; }

table {
    width: 100%;
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    margin: 16px 0 28px;
    box-shadow: 0 8px 24px rgba(23, 55, 94, .04);
}
th, td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}
th {
    background: #eef3f9;
    color: var(--heading);
    font-size: 12px;
    font-weight: 700;
}
td { color: #424242; font-size: 14px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcff; }
.table-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 8px;
    scrollbar-color: #c7ced8 transparent;
}
.table-scroll::-webkit-scrollbar {
    height: 10px;
}
.table-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.table-scroll::-webkit-scrollbar-thumb {
    background: #c7ced8;
    border-radius: 999px;
    border: 3px solid var(--surface);
}
.table-scroll table {
    margin-top: 0;
}
.table-scroll th,
.table-scroll td {
    white-space: nowrap;
}
.table-scroll th:first-child,
.table-scroll td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
}
.table-scroll th:first-child {
    background: #eef3f9;
}
.table-scroll td:first-child {
    background: var(--surface);
    box-shadow: 1px 0 0 var(--line);
}
.table-scroll tbody tr:hover td:first-child {
    background: #fafcff;
}
.table-scroll td.wrap {
    min-width: 260px;
    white-space: normal;
}
.actions-cell {
    display: flex;
    gap: 8px;
    align-items: center;
}
.actions-cell form {
    margin: 0;
}
.actions-cell .button {
    min-width: 78px;
    padding: 8px 12px;
}
.muted-cell {
    color: var(--muted);
    font-size: 12px;
}
.table-check {
    width: auto;
    min-width: 16px;
}

.sidebar {
    position: fixed;
    inset: 8px auto 0 0;
    width: 236px;
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 22px 14px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.brand {
    min-height: 58px;
    display: grid;
    align-content: center;
    gap: 6px;
    padding: 0 8px 16px;
    border-bottom: 1px solid var(--line);
}
.brand img {
    width: 132px;
    height: auto;
    display: block;
}
.brand span {
    color: var(--soft);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.sidebar nav {
    display: grid;
    gap: 3px;
    overflow-y: auto;
    padding-right: 2px;
}
.sidebar a {
    position: relative;
    min-height: 37px;
    display: flex;
    align-items: center;
    color: #5d6470;
    padding: 9px 10px 9px 22px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}
.sidebar a::before {
    content: "";
    position: absolute;
    left: 9px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #c7ced8;
}
.sidebar a.active {
    background: #eef3f9;
    color: var(--heading);
    font-weight: 700;
}
.sidebar a.active::before { background: var(--accent); }
.sidebar a:hover { background: #f7f9fc; color: var(--heading); }
.nav-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.nav-section-title {
    padding: 0 10px 7px;
    color: var(--soft);
    font-size: 12px;
    font-weight: 700;
}
.sidebar a.nav-child {
    min-height: 34px;
    margin-left: 8px;
    padding-left: 24px;
    font-size: 13px;
}
.sidebar a.nav-child::before {
    left: 10px;
    width: 3px;
    height: 3px;
}

.main {
    margin-left: 236px;
    padding: 34px 34px 52px;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin: -26px -34px 28px;
    padding: 16px 34px;
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 8px;
    z-index: 20;
}
.topbar div:first-child { display: grid; gap: 2px; }
.topbar span { font-weight: 700; color: var(--heading); }
.topbar small { color: var(--soft); font-size: 12px; }
.topbar div:last-child { display: flex; gap: 12px; align-items: center; }
.user-chip {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 12px;
    background: #fff;
    color: var(--heading);
    font-weight: 700;
}

.hero {
    position: relative;
    min-height: 244px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    align-items: end;
    gap: 24px;
    padding: 40px 36px 30px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}
.hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 10px;
    background: var(--yellow);
}
.hero-logo {
    position: absolute;
    right: 28px;
    top: 26px;
    width: 124px;
    height: auto;
    display: block;
}
.hero h1 {
    margin: 0;
    max-width: 620px;
    font-size: clamp(34px, 4vw, 52px);
    line-height: 1.08;
    font-weight: 700;
    color: var(--heading);
}
.hero p {
    max-width: 620px;
    color: #666;
    font-size: 15px;
    line-height: 1.65;
}
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}
.hero-mascot {
    width: 185px;
    max-width: 100%;
    align-self: end;
    justify-self: end;
    margin-bottom: -42px;
    opacity: .96;
}
.eyebrow {
    margin: 0 0 10px;
    color: var(--accent);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.metric, .panel, .feed-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 8px 24px rgba(23, 55, 94, .04);
}
.metric {
    min-height: 112px;
    display: grid;
    align-content: space-between;
    border-top: 3px solid var(--blue);
}
.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}
.metric strong {
    font-size: clamp(26px, 3vw, 36px);
    line-height: 1;
    font-weight: 700;
    color: var(--heading);
}
.metric:nth-child(2) { border-top-color: var(--accent); }
.metric:nth-child(3) { border-top-color: var(--yellow); }
.metric:nth-child(4) { border-top-color: var(--success); }

.employee-hero {
    min-height: 232px;
}
.employee-metrics .metric strong {
    font-size: clamp(24px, 2.6vw, 32px);
    white-space: nowrap;
}
.employee-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.employee-tile {
    min-height: 120px;
    display: grid;
    align-content: space-between;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(23, 55, 94, .04);
}
.employee-tile strong {
    color: var(--heading);
    font-size: 18px;
}
.employee-tile span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}
.employee-tile:hover {
    border-color: #d9e4f1;
    background: #fafcff;
}
.onboarding-panel {
    position: relative;
    overflow: hidden;
}
.onboarding-panel::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    width: 8px;
    height: 100%;
    background: var(--yellow);
}
.onboarding-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 18px;
    margin-bottom: 18px;
}
.onboarding-head h2 {
    margin: 0 0 4px;
    color: var(--heading);
    font-size: 28px;
}
.onboarding-head small {
    color: var(--muted);
    font-weight: 700;
}
.empty-state {
    min-height: 260px;
    display: grid;
    align-content: center;
    max-width: 720px;
}
.empty-state h1 {
    margin: 0;
    color: var(--heading);
}
.empty-state p {
    max-width: 560px;
    color: var(--muted);
    line-height: 1.7;
}
.event-card {
    max-width: 860px;
}

.split {
    display: grid;
    grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr);
    gap: 20px;
}
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin: 10px 0 14px;
}
.section-title > div {
    min-width: 0;
}
.section-title .button {
    flex: 0 0 auto;
}
.section-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
.section-title h1, .section-title h2 { margin: 0; color: var(--heading); font-weight: 700; }
.section-title h1 { font-size: clamp(28px, 3vw, 40px); line-height: 1.08; }
.section-title h2 { font-size: 20px; }
.section-title span { color: var(--muted); font-size: 13px; line-height: 1.5; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
}
.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 12px 0;
}
.toolbar input { max-width: 180px; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 108px;
    cursor: pointer;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--heading);
    border-radius: 6px;
    padding: 10px 16px;
    font-weight: 700;
}
.button.primary {
    background: var(--heading);
    border-color: var(--heading);
    color: #fff;
}
.button.ghost {
    background: #fff;
    border-color: var(--line);
    color: #555;
}
.button:hover {
    border-color: var(--blue);
    background: #f7f9fc;
    color: var(--heading);
}
.button.primary:hover {
    background: var(--heading-2);
    color: #fff;
}

.feed-item { margin-bottom: 12px; }
.feed-item span, .tag {
    display: inline-flex;
    border-radius: 999px;
    background: #eef3f9;
    color: var(--heading-2);
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
}
.feed-item h3 { margin: 10px 0 6px; font-size: 18px; color: var(--heading); }
.feed-item p { color: #666; line-height: 1.62; }
.feed-item small, .empty { color: var(--muted); }
.flash {
    background: #fff8e3;
    color: #7a5300;
    border: 1px solid #f3df8f;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 700;
}
.template-list { display: grid; gap: 12px; }

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 16px;
}
.tabs a {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 6px;
    padding: 9px 12px;
    color: #555;
    font-weight: 700;
}
.tabs a.active {
    background: #eef3f9;
    color: var(--heading);
    border-color: #d9e4f1;
}
.field { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.field input, .field select, .field textarea { color: var(--text); font-weight: 500; }
.field.full { grid-column: 1 / -1; }
.dynamic-form .button { margin-top: 14px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; }
.check input { width: auto; }
.add-panel {
    margin: 18px 0;
}
.add-panel > summary {
    list-style: none;
    margin-bottom: 16px;
}
.add-panel > summary::-webkit-details-marker { display: none; }
.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 100;
}
.modal.open {
    display: block;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(23, 55, 94, .32);
    backdrop-filter: blur(8px);
}
.modal-panel {
    position: relative;
    width: min(920px, calc(100vw - 36px));
    max-height: calc(100vh - 56px);
    margin: 28px auto;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 28px 70px rgba(23, 55, 94, .18);
}
.modal-panel::before {
    content: "";
    position: sticky;
    top: 0;
    display: block;
    height: 8px;
    background: var(--yellow);
    z-index: 1;
}
.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 18px;
    padding: 22px 24px 10px;
}
.modal-head h2 {
    margin: 0;
    color: var(--heading);
    font-size: 24px;
}
.modal-head span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}
.modal-close {
    min-width: 36px;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
}
.modal-body {
    padding: 14px 24px 24px;
}
.modal-body .form-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
}
body.modal-open {
    overflow: hidden;
}
.account-edit-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 10px;
    align-items: center;
}
.record-edit-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 10px;
    align-items: center;
}
.salary-edit-grid {
    grid-template-columns: repeat(4, minmax(110px, 1fr));
}
.account-edit-grid input,
.account-edit-grid select,
.record-edit-grid input,
.record-edit-grid select {
    min-width: 0;
}
.score-form {
    display: grid;
    grid-template-columns: 86px minmax(160px, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-width: 360px;
}
.settings-form {
    display: grid;
    gap: 18px;
}
.settings-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 24px;
    align-items: start;
}
.settings-main {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.settings-aside {
    border-left: 1px solid var(--line);
    padding-left: 24px;
}
.favicon-preview {
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    margin: 8px 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.favicon-preview img {
    max-width: 42px;
    max-height: 42px;
}
.favicon-preview span {
    color: var(--soft);
    font-size: 12px;
}
.settings-aside small {
    display: block;
    margin-top: 10px;
    color: var(--muted);
    line-height: 1.55;
}
.settings-path {
    margin: -4px 0 12px;
    word-break: break-all;
}

.login-body {
    display: grid;
    place-items: center;
    padding: 32px;
    background: #fff;
}
.login-shell {
    position: relative;
    width: min(980px, 100%);
    min-height: 560px;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.login-shell::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 10px;
    background: var(--yellow);
    z-index: 1;
}
.login-brand {
    position: relative;
    min-height: 560px;
    display: grid;
    align-content: center;
    padding: 72px 52px 48px;
    overflow: hidden;
}
.login-logo {
    position: absolute;
    top: 34px;
    right: 38px;
    width: 132px;
    height: auto;
    z-index: 2;
}
.login-brand h1 {
    max-width: 440px;
    margin: 0;
    font-size: clamp(36px, 4vw, 54px);
    line-height: 1.08;
    font-weight: 700;
    color: var(--heading);
}
.login-brand p:not(.eyebrow) {
    max-width: 400px;
    color: #666;
    line-height: 1.65;
}
.login-mascot {
    position: absolute;
    right: -38px;
    bottom: -70px;
    width: min(260px, 42%);
    opacity: .96;
}
.login-box {
    display: grid;
    align-content: center;
    padding: 46px;
    background: var(--surface-soft);
    border-left: 1px solid var(--line);
}
.login-box h2 {
    margin: 0 0 22px;
    font-size: 30px;
    line-height: 1.08;
    color: var(--heading);
}
.login-box form { display: grid; gap: 12px; }
.login-box .button { width: 100%; }
.login-box small { display: block; margin-top: 16px; color: var(--soft); }

@media (max-width: 1020px) {
    .hero { grid-template-columns: 1fr; }
    .hero-mascot { width: 160px; justify-self: end; margin-top: -48px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
    .employee-actions { grid-template-columns: 1fr; }
    .account-edit-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
    .record-edit-grid, .salary-edit-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
    .score-form { grid-template-columns: 1fr; min-width: 0; }
    .settings-layout { grid-template-columns: 1fr; }
    .settings-aside { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 18px; }
}

@media (max-width: 760px) {
    .sidebar {
        position: static;
        width: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .main { margin-left: 0; padding: 26px 18px; }
    .topbar { margin: -18px -18px 18px; padding: 14px 18px; position: static; }
    .hero { padding: 42px 24px 24px; }
    .hero-logo { width: 110px; right: 20px; top: 24px; }
    .metric-grid, .form-grid { grid-template-columns: 1fr; }
    .settings-main { grid-template-columns: 1fr; }
    .section-title { align-items: start; flex-direction: column; }
    .section-actions { justify-content: flex-start; }
    .toolbar { flex-wrap: wrap; }
    table { min-width: 920px; }
    .login-body { padding: 18px; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { min-height: 390px; padding: 76px 28px 32px; }
    .login-logo { width: 116px; top: 28px; right: 28px; }
    .login-mascot { width: 180px; right: -40px; bottom: -62px; }
    .login-box { padding: 32px 28px; border-left: 0; border-top: 1px solid var(--line); }
    .modal-panel { width: calc(100vw - 20px); margin: 10px auto; max-height: calc(100vh - 20px); }
    .modal-body .form-grid { grid-template-columns: 1fr; }
}
