/* =============================================
   Employee Evaluation System
   Forest Theme · v2 — denser, calmer, clearer
   ============================================= */

:root {
    /* 主色 - 森林綠 (v3: 更深、飽和度更高的企業綠階) */
    --forest-deepest: #04342C;
    --forest-dark: #085041;
    --forest-medium: #0F6E56;
    --forest-light: #1D9E75;
    --forest-lighter: #5DCAA5;
    --forest-lightest: #9FE1CB;
    --forest-pale: #E1F5EE;
    --forest-bg: #F2F9F6;

    /* 語意色 */
    --amber-50: #FAEEDA;
    --amber-600: #BA7517;
    --amber-700: #854F0B;
    --red-50: #FCEBEB;
    --red-600: #A32D2D;
    --purple-600: #534AB7;

    /* 米色 */
    --beige-dark: #C9B896;
    --beige-medium: #E5D9C3;
    --beige-light: #F5EFE4;
    --beige-lightest: #FAF8F4;

    /* 中性色 */
    --charcoal: #2A2A2A;
    --charcoal-light: #5A5A5A;
    --coral: #D4A574;
    --coral-light: #E8C9A8;
    --white: #FFFFFF;
    --gray-50: #FAFAFA;
    --gray-100: #F6F6F4;
    --gray-200: #ECECE9;
    --gray-300: #DCDCD8;
    --gray-400: #BFBFBA;
    --gray-500: #999996;
    --gray-600: #767672;
    --gray-700: #5C5B58;
    --gray-800: #3A3A38;

    /* 陰影 */
    --shadow-xs: 0 1px 2px rgba(45,90,74,0.04);
    --shadow-sm: 0 1px 3px rgba(45,90,74,0.06);
    --shadow-md: 0 3px 10px rgba(45,90,74,0.07);
    --shadow-lg: 0 6px 20px rgba(45,90,74,0.09);

    /* 圓角 */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;

    /* 尺寸 */
    --sidebar-width: 224px;
    --topbar-height: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
    font-family: 'Noto Sans TC', 'Segoe UI', sans-serif;
    background-color: var(--gray-100);
    color: var(--charcoal);
    line-height: 1.55;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--forest-deepest) 0%, #063D33 100%);
    color: var(--white);
    z-index: 1000;
    overflow-y: auto;
    transition: width 0.2s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-header .brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.sidebar-header .brand-text { line-height: 1.15; }
.sidebar-header h4 {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}
.sidebar-header small {
    opacity: 0.55;
    font-size: 0.7rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.sidebar-nav {
    padding: 10px 8px 16px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-section {
    padding: 12px 14px 4px;
    font-size: 0.68rem;
    color: rgba(255,255,255,0.42);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    color: rgba(255,255,255,0.72);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.15s ease, color 0.15s ease;
    border-radius: 6px;
    margin: 1px 4px;
    border-left: none;
    position: relative;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: var(--white);
}

.sidebar-nav .nav-link.active {
    background: rgba(255,255,255,0.14);
    color: var(--white);
    font-weight: 600;
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--forest-lightest);
}

.sidebar-nav .nav-link i {
    width: 18px;
    margin-right: 10px;
    text-align: center;
    font-size: 0.95rem;
    opacity: 0.85;
}

.sidebar-nav hr {
    border: 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 10px 14px;
}

/* ===== Main Content ===== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.2s ease;
}

/* ===== Top Navbar ===== */
.top-navbar {
    background: var(--white);
    padding: 0 24px;
    height: var(--topbar-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-xs);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-navbar .page-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--forest-dark);
    letter-spacing: 0.2px;
}

.top-navbar .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-navbar .user-info .user-name {
    font-size: 0.85rem;
    color: var(--gray-700);
}

.top-navbar .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--forest-medium), var(--forest-light));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.78rem;
}

/* ===== Content Area ===== */
.content-area {
    padding: 22px 28px 40px;
}

/* ===== Page Header (new) ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.page-header h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--forest-dark);
    margin: 0;
}
.page-header .page-subtitle {
    color: var(--gray-600);
    font-size: 0.85rem;
    margin-top: 2px;
}
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Toolbar (sticky filter bar) ===== */
.toolbar {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-xs);
}
.toolbar .form-label {
    margin-bottom: 0;
    font-size: 0.8rem;
    color: var(--gray-600);
    white-space: nowrap;
}
.toolbar .form-select, .toolbar .form-control { min-width: 180px; }
.toolbar-spacer { flex: 1; }

/* ===== Cards ===== */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    transition: box-shadow 0.2s ease;
}

.card:hover { box-shadow: var(--shadow-sm); }

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--gray-200);
    padding: 12px 18px;
    font-weight: 600;
    color: var(--forest-dark);
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header i { color: var(--forest-medium); }

.card-body { padding: 18px; }

/* ===== Stat Cards (compact) ===== */
.stat-card {
    border-radius: var(--radius);
    padding: 16px 18px;
    color: var(--white);
    position: relative;
    overflow: hidden;
    min-height: 92px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -28px;
    right: -28px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}

.stat-card.bg-forest        { background: linear-gradient(135deg, var(--forest-dark), var(--forest-medium)); }
.stat-card.bg-forest-light  { background: linear-gradient(135deg, var(--forest-medium), var(--forest-light)); }
.stat-card.bg-coral         { background: linear-gradient(135deg, #D78A6A, #C76151); }
.stat-card.bg-charcoal      { background: linear-gradient(135deg, #3F3F3F, #5A5A5A); }

.stat-card .stat-number {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    opacity: 0.88;
    margin-top: 4px;
    letter-spacing: 0.3px;
}

.stat-card .stat-icon {
    position: absolute;
    bottom: 12px;
    right: 14px;
    font-size: 1.6rem;
    opacity: 0.25;
}

/* ===== Tables ===== */
.table {
    margin-bottom: 0;
    color: var(--charcoal);
}

.table thead th {
    background: var(--gray-50);
    color: var(--gray-700);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--gray-200);
    border-top: none;
    padding: 10px 12px;
    white-space: nowrap;
}

.table tbody td {
    padding: 10px 12px;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.88rem;
}

.table tbody tr:hover { background-color: var(--forest-bg); }

.table tbody tr:last-child td { border-bottom: none; }

.table-sm thead th,
.table-sm tbody td { padding: 8px 10px; font-size: 0.82rem; }

/* ===== Buttons ===== */
.btn {
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.btn-forest {
    background: var(--forest-medium);
    color: var(--white);
    border: none;
}

.btn-forest:hover {
    background: var(--forest-dark);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-forest-outline {
    background: transparent;
    color: var(--forest-medium);
    border: 1px solid var(--forest-medium);
}

.btn-forest-outline:hover {
    background: var(--forest-medium);
    color: var(--white);
}

.btn-coral {
    background: var(--coral);
    color: var(--white);
    border: none;
}

.btn-coral:hover { background: #C96A50; color: var(--white); }

.btn-sm { padding: 4px 10px; font-size: 0.78rem; }

.btn-lg { padding: 9px 22px; font-size: 0.95rem; }

.btn i { margin-right: 4px; }
.btn i:only-child { margin-right: 0; }

/* ===== Forms ===== */
.form-control, .form-select {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    font-size: 0.88rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background-color: var(--white);
}

.form-control:focus, .form-select:focus {
    border-color: var(--forest-light);
    box-shadow: 0 0 0 3px rgba(64, 145, 108, 0.12);
}

.form-control-sm, .form-select-sm {
    padding: 5px 10px;
    font-size: 0.82rem;
}

.form-label {
    font-weight: 500;
    font-size: 0.82rem;
    color: var(--gray-700);
    margin-bottom: 4px;
}

/* ===== Modals ===== */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background: var(--forest-bg);
    border-bottom: 1px solid var(--forest-pale);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 14px 20px;
}

.modal-title {
    color: var(--forest-dark);
    font-weight: 600;
    font-size: 1rem;
}

.modal-body { padding: 20px; }

.modal-footer {
    border-top: 1px solid var(--gray-200);
    padding: 12px 20px;
}

/* ===== Badges ===== */
.badge {
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    letter-spacing: 0.2px;
}

.badge-forest {
    background: var(--forest-pale);
    color: var(--forest-dark);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
}

.badge-active { background: var(--forest-light); color: var(--white); }
.badge-draft  { background: var(--gray-400); color: var(--white); }
.badge-closed { background: var(--coral); color: var(--white); }

.badge-region {
    background: var(--beige-medium);
    color: var(--charcoal);
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
}

/* ===== Tree View ===== */
.tree-view { padding: 4px 0; }

.tree-node {
    padding: 6px 10px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin: 1px 0;
    transition: all 0.12s ease;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

.tree-node:hover { background: var(--forest-bg); }

.tree-node.active {
    background: var(--forest-pale);
    color: var(--forest-dark);
    font-weight: 500;
}

.tree-node i {
    margin-right: 8px;
    width: 14px;
    text-align: center;
    color: var(--forest-medium);
}

.tree-children { padding-left: 16px; }

/* ===== Score / Adjusted Score ===== */
.score-adjusted {
    color: var(--forest-dark);
    font-weight: 700;
}

.score-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--forest-pale);
    color: var(--forest-medium);
    font-size: 0.65rem;
    margin-left: 4px;
    cursor: pointer;
}

.score-unadjusted { color: var(--gray-500); }

/* ===== Login Page ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--forest-dark) 0%, var(--forest-medium) 50%, var(--forest-light) 100%);
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 44px 40px;
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    color: var(--forest-dark);
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 1.5rem;
}

.login-card .subtitle {
    color: var(--gray-500);
    font-size: 0.88rem;
    margin-bottom: 28px;
}

/* ===== Welcome Hero (user dashboard) ===== */
.welcome-hero {
    background: linear-gradient(135deg, var(--forest-dark), var(--forest-medium));
    color: var(--white);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    margin-bottom: 18px;
    position: relative;
    overflow: hidden;
}
.welcome-hero::after {
    content: '';
    position: absolute;
    right: -30px;
    top: -30px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
}
.welcome-hero h3 { font-size: 1.3rem; font-weight: 600; margin: 0 0 6px; }
.welcome-hero .welcome-meta { font-size: 0.85rem; opacity: 0.85; }
.welcome-hero .welcome-meta span + span::before {
    content: '·';
    margin: 0 8px;
    opacity: 0.6;
}

/* ===== Info Box (replaces inline forest-pale boxes) ===== */
.info-box {
    background: var(--forest-bg);
    border-left: 3px solid var(--forest-light);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 10px;
}
.info-box strong { color: var(--forest-dark); display: block; margin-bottom: 2px; font-size: 0.88rem; }
.info-box p { margin: 0; font-size: 0.82rem; color: var(--gray-700); }

/* ===== Period Pill (active period chips) ===== */
.period-pill {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--forest-bg);
    border: 1px solid var(--forest-pale);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: border-color 0.15s ease;
}
.period-pill:hover { border-color: var(--forest-lightest); }
.period-pill strong { color: var(--forest-dark); font-size: 0.92rem; }
.period-pill small { color: var(--gray-600); }

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .content-area { padding: 16px; }
}

@media (max-width: 768px) {
    .top-navbar { padding: 0 14px; }
    .content-area { padding: 14px; }
    .stat-card { margin-bottom: 10px; }
    .page-header { gap: 8px; }
    .page-header h2 { font-size: 1.15rem; }
}

/* ===== Utilities ===== */
.text-forest { color: var(--forest-medium); }
.text-forest-dark { color: var(--forest-dark); }
.bg-forest-pale { background: var(--forest-pale); }
.bg-beige-light { background: var(--beige-light); }
.border-forest { border-color: var(--forest-lightest) !important; }
.text-muted { color: var(--gray-600) !important; }

/* ===== Collapse Sections ===== */
.collapse-section {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 10px;
    overflow: hidden;
    background: var(--white);
}

.collapse-header {
    background: var(--gray-50);
    padding: 11px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s ease;
    font-weight: 500;
    color: var(--forest-dark);
    font-size: 0.9rem;
}

.collapse-header:hover { background: var(--gray-100); }

.collapse-header .collapse-icon { transition: transform 0.25s ease; }
.collapse-header.collapsed .collapse-icon { transform: rotate(-90deg); }

.collapse-body {
    padding: 14px 16px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
}

/* ===== Progress Bar ===== */
.progress-forest {
    height: 8px;
    border-radius: 4px;
    background: var(--gray-200);
    overflow: hidden;
}

.progress-forest .progress-bar {
    background: linear-gradient(90deg, var(--forest-medium), var(--forest-lighter));
    border-radius: 4px;
    transition: width 0.4s ease;
}

.progress-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 4px;
}

/* ===== Todo / Alert Items ===== */
.todo-item {
    display: flex;
    align-items: flex-start;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    background: var(--gray-50);
    border-left: 3px solid var(--forest-light);
}

.todo-item.warning {
    border-left-color: var(--coral);
    background: #FBF5F0;
}

.todo-item.success {
    border-left-color: var(--forest-lighter);
    background: var(--forest-bg);
}

.todo-item i {
    margin-right: 10px;
    margin-top: 2px;
    font-size: 1rem;
}

.todo-item strong { font-size: 0.88rem; }
.todo-item p { font-size: 0.8rem; color: var(--gray-600); margin: 2px 0 0; }

/* ===== File Upload ===== */
.file-upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    background: var(--gray-50);
    transition: all 0.2s ease;
    cursor: pointer;
}

.file-upload-zone:hover,
.file-upload-zone.dragover {
    border-color: var(--forest-light);
    background: var(--forest-bg);
}

.file-upload-zone i {
    font-size: 2.5rem;
    color: var(--forest-light);
    margin-bottom: 8px;
}

.file-upload-zone p { color: var(--gray-700); margin-bottom: 4px; }
.file-upload-zone small { color: var(--gray-500); }

/* ===== Tabs ===== */
.nav-tabs-forest {
    border-bottom: 1px solid var(--gray-200);
    gap: 4px;
}

.nav-tabs-forest .nav-link {
    color: var(--gray-600);
    border: none;
    padding: 9px 16px;
    font-weight: 500;
    font-size: 0.88rem;
    position: relative;
    background: transparent;
}

.nav-tabs-forest .nav-link::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 12px;
    right: 12px;
    height: 2px;
    background: transparent;
    border-radius: 2px 2px 0 0;
    transition: background 0.15s ease;
}

.nav-tabs-forest .nav-link:hover { color: var(--forest-medium); }
.nav-tabs-forest .nav-link.active { color: var(--forest-dark); background: transparent; }
.nav-tabs-forest .nav-link.active::after { background: var(--forest-medium); }

/* ===== Evaluation Type Cards ===== */
.eval-type-card {
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    transition: all 0.15s ease;
    cursor: pointer;
    background: var(--white);
}

.eval-type-card:hover {
    border-color: var(--forest-light);
    box-shadow: var(--shadow-sm);
}

.eval-type-card.selected {
    border-color: var(--forest-medium);
    background: var(--forest-bg);
}

.eval-type-card .type-icon {
    font-size: 2rem;
    color: var(--forest-medium);
    margin-bottom: 8px;
}

.eval-type-card .type-title {
    font-weight: 600;
    color: var(--forest-dark);
    margin-bottom: 2px;
    font-size: 0.92rem;
}

.eval-type-card .type-desc {
    font-size: 0.8rem;
    color: var(--gray-600);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }

/* ===== Sortable Headers ===== */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: relative;
    padding-right: 22px !important;
}
th.sortable:hover { background-color: var(--forest-bg); }
th.sortable .sort-icon {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
    margin-left: 4px;
    font-size: 0.55rem;
    line-height: 1;
    color: var(--gray-400);
}
th.sortable .sort-icon .bi { line-height: 0.7; }
th.sortable.asc .sort-icon .bi-caret-up-fill,
th.sortable.desc .sort-icon .bi-caret-down-fill { color: var(--forest-dark); }
th.sortable.asc .sort-icon .bi-caret-down-fill,
th.sortable.desc .sort-icon .bi-caret-up-fill { color: var(--gray-300); }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--gray-500);
}
.empty-state i {
    font-size: 2.2rem;
    display: block;
    margin-bottom: 8px;
    opacity: 0.55;
}
.empty-state p { margin: 0; font-size: 0.88rem; }

/* ===== Misc Bootstrap overrides ===== */
.alert { border-radius: var(--radius); border: none; padding: 12px 14px; font-size: 0.86rem; }
.alert-info { background: #E7F1F9; color: #1E5A8C; }
.alert-success { background: var(--forest-pale); color: var(--forest-dark); }
.alert-warning { background: #FDF6E3; color: #8B6914; }
.alert-danger { background: #FBE9E7; color: #9C3A2C; }
.alert i { margin-right: 6px; }

hr { border-color: var(--gray-200); opacity: 1; margin: 14px 0; }

/* spacing helpers for tighter layouts */
.row > [class^="col-"] { margin-bottom: 14px; }
.row.no-mb > [class^="col-"] { margin-bottom: 0; }

/* link buttons in quick-action lists */
.btn-forest-outline.text-start { padding: 9px 14px; }

/* =============================================
   v3 — Evaluation flow components
   (stepper / pills / chips / matrix / submit bar)
   ============================================= */

/* ===== Breadcrumb (topbar) ===== */
.crumb { font-size: 0.8rem; color: var(--gray-500); }
.crumb .crumb-cur { color: var(--charcoal); font-weight: 600; }
.crumb .crumb-sep { margin: 0 6px; opacity: 0.6; }

/* ===== Stepper ===== */
.stepper {
    display: flex; align-items: center; gap: 8px;
    background: var(--white); border: 1px solid var(--gray-200);
    border-radius: var(--radius); padding: 13px 20px; margin-bottom: 16px;
    box-shadow: var(--shadow-xs); flex-wrap: wrap;
}
.stepper .step { display: flex; align-items: center; gap: 8px; }
.stepper .step .dot {
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 600; flex-shrink: 0;
}
.stepper .step.done .dot { background: var(--forest-medium); color: var(--white); }
.stepper .step.cur  .dot { border: 2px solid var(--forest-medium); color: var(--forest-medium); }
.stepper .step.todo .dot { border: 1.5px solid var(--gray-300); color: var(--gray-400); }
.stepper .step span { font-size: 0.82rem; color: var(--gray-600); white-space: nowrap; }
.stepper .step.cur span { color: var(--charcoal); font-weight: 600; }
.stepper .step.todo span { color: var(--gray-400); }
.stepper .step-line { flex: 1; height: 2px; background: var(--gray-200); max-width: 52px; min-width: 16px; border-radius: 2px; }
.stepper .step-line.on { background: var(--forest-light); }

/* ===== Pills ===== */
.pill {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.74rem; padding: 3px 10px; border-radius: 99px; white-space: nowrap;
    font-weight: 500;
}
.pill.ok   { background: var(--forest-pale); color: var(--forest-dark); }
.pill.warn { background: var(--amber-50); color: var(--amber-700); }
.pill.bad  { background: var(--red-50); color: var(--red-600); }
.pill.mut  { background: var(--gray-200); color: var(--gray-700); }

/* ===== Person chips (peer picker) ===== */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.78rem; padding: 4px 10px; border-radius: 99px;
    background: var(--forest-pale); color: var(--forest-dark);
}
.chip.same { background: var(--gray-200); color: var(--gray-700); }
.chip .chip-x { cursor: pointer; opacity: 0.6; font-size: 0.72rem; }
.chip .chip-x:hover { opacity: 1; color: var(--red-600); }

/* ===== Filter chips (dept filter in picker) ===== */
.fchip {
    display: inline-flex; align-items: center;
    font-size: 0.78rem; padding: 5px 12px; border-radius: 99px;
    border: 1px solid var(--gray-300); background: var(--white);
    color: var(--gray-600); cursor: pointer; user-select: none;
    transition: all 0.12s ease;
}
.fchip:hover { border-color: var(--forest-light); color: var(--forest-medium); }
.fchip.active { background: var(--forest-pale); border-color: var(--forest-light); color: var(--forest-dark); font-weight: 500; }

/* ===== Summary / utility bar ===== */
.flowbar {
    display: flex; align-items: center; gap: 10px;
    background: var(--white); border: 1px solid var(--gray-200);
    border-radius: var(--radius); padding: 11px 16px; margin-bottom: 12px;
    box-shadow: var(--shadow-xs); flex-wrap: wrap;
}
.flowbar .spacer { flex: 1; }

.hintline { font-size: 0.78rem; color: var(--gray-500); margin: 2px 2px 12px; }
.hintline i { margin-right: 3px; }

/* ===== Matrix group card ===== */
.eval-group {
    background: var(--white); border: 1px solid var(--gray-200);
    border-radius: var(--radius); margin-bottom: 12px; overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.eval-group-head {
    display: flex; align-items: center; gap: 9px;
    padding: 11px 16px; cursor: pointer; user-select: none;
}
.eval-group-head:hover { background: var(--gray-50); }
.eval-group-head .chev { font-size: 0.78rem; color: var(--gray-400); transition: transform 0.15s ease; }
.eval-group.open .eval-group-head .chev { transform: rotate(90deg); }
.eval-group-head .gname { font-weight: 600; font-size: 0.92rem; color: var(--forest-dark); }
.eval-group-head .gmeta { font-size: 0.78rem; color: var(--gray-500); }
.eval-group-head .spacer { flex: 1; }
.eval-group-head .gsum { font-size: 0.85rem; font-weight: 600; color: var(--forest-medium); }
.eval-group-body { display: none; border-top: 1px solid var(--gray-200); }
.eval-group.open .eval-group-body { display: block; }
.eval-group-scroll { overflow-x: auto; max-height: 72vh; overflow-y: auto; }
.eval-group-foot {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 16px; border-top: 1px solid var(--gray-100);
    font-size: 0.78rem; color: var(--gray-500); gap: 10px; flex-wrap: wrap;
}

/* ===== Score matrix ===== */
table.mx { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.85rem; }
.mx th, .mx td { border-bottom: 1px solid var(--gray-100); padding: 0; background: var(--white); }
.mx thead th {
    background: var(--gray-50); font-weight: 600; padding: 8px 6px;
    text-align: center; position: sticky; top: 0; z-index: 5;
    border-bottom: 1px solid var(--gray-200);
}
.mx th.itemh, .mx td.item {
    text-align: left; padding: 7px 14px;
    min-width: 170px; max-width: 240px;
    position: sticky; left: 0; z-index: 4;
}
.mx thead th.itemh { z-index: 6; }
.mx td.item { background: var(--white); }
.mx td.item .iw { display: block; font-size: 0.72rem; color: var(--gray-500); }
.mx td.item .itip { cursor: help; border-bottom: 1px dashed var(--gray-400); }
.mx th .nm { font-weight: 600; font-size: 0.85rem; white-space: nowrap; }
.mx th .st { display: block; font-size: 0.72rem; font-weight: 400; color: var(--gray-500); margin-top: 2px; }
.mx th .st.ok { color: var(--forest-medium); }
.mx th .st.warn { color: var(--amber-600); }
.mx th .rm { color: var(--gray-400); cursor: pointer; font-size: 0.72rem; margin-left: 4px; }
.mx th .rm:hover { color: var(--red-600); }
.mx th .fillcol { color: var(--gray-400); cursor: pointer; font-size: 0.78rem; margin-left: 4px; }
.mx th .fillcol:hover { color: var(--forest-medium); }
.mx .tagx { font-size: 0.66rem; padding: 1px 8px; border-radius: 99px; display: inline-block; margin-top: 3px; font-weight: 500; }
.mx .tagx.cross { background: var(--forest-pale); color: var(--forest-dark); }
.mx .tagx.same { background: var(--gray-200); color: var(--gray-700); }

.mx td.cell { text-align: center; border-left: 1px solid var(--gray-100); position: relative; min-width: 76px; }
.mx td.cell input {
    width: 100%; border: none; background: none; text-align: center;
    font: inherit; font-size: 0.88rem; padding: 8px 4px; outline: none; color: var(--charcoal);
}
.mx td.cell input::placeholder { color: var(--gray-300); }
.mx td.cell.colhi, .mx th.colhi { background: var(--forest-pale); }
.mx tr.rowhi td { background: var(--forest-bg); }
.mx tr.rowhi td.cell.colhi { background: var(--forest-pale); }
.mx td.cell:focus-within { outline: 2px solid var(--forest-light); outline-offset: -2px; background: var(--white) !important; }
.mx td.cell.dirty::after {
    content: ''; position: absolute; top: 4px; right: 5px;
    width: 6px; height: 6px; border-radius: 50%; background: var(--amber-600);
}
.mx td.cell.invalid { outline: 2px solid var(--red-600); outline-offset: -2px; }
.mx td.cell.invalid input { color: var(--red-600); font-weight: 700; }
.mx td.cell.locked { background: var(--gray-50); }
.mx td.cell.locked input { color: var(--gray-500); }
.mx td.cell .cmark {
    position: absolute; top: 0; right: 0; width: 0; height: 0;
    border-top: 6px solid var(--coral); border-left: 6px solid transparent;
    cursor: pointer;
}
.mx td.cell .chint {
    display: block; font-size: 0.64rem; color: var(--amber-600);
    line-height: 1; padding-bottom: 4px; cursor: pointer;
}
.mx td.na {
    background: repeating-linear-gradient(45deg, var(--gray-100), var(--gray-100) 4px, var(--white) 4px, var(--white) 8px);
    border-left: 1px solid var(--gray-100);
}
.mx tr.secrow td {
    background: var(--gray-50); border-left: 3px solid var(--purple-600); border-radius: 0;
    font-size: 0.76rem; font-weight: 700; color: var(--gray-700); padding: 5px 14px;
    position: sticky; left: 0;
}
.mx tr.secrow.secb td { border-left-color: var(--forest-light); }
.mx tr.totrow td {
    background: var(--gray-50); font-weight: 700; padding: 8px 6px;
    text-align: center; border-left: 1px solid var(--gray-100);
    border-top: 1px solid var(--gray-200);
    position: sticky; bottom: 0; z-index: 4;
}
.mx tr.totrow td.item { text-align: left; padding: 8px 14px; z-index: 5; }
.mx td.tot { font-size: 0.98rem; color: var(--forest-medium); }
.mx td.tot.empty { color: var(--gray-400); font-weight: 400; }
.mx th.addcol, .mx td.addcol { border-left: 1px dashed var(--gray-300); min-width: 56px; }
.mx th.addcol { color: var(--gray-500); font-size: 0.76rem; cursor: pointer; font-weight: 500; }
.mx th.addcol:hover { color: var(--forest-medium); background: var(--forest-bg); }

/* ===== Fixed submit bar ===== */
.submitbar {
    position: fixed; left: var(--sidebar-width); right: 0; bottom: 0;
    background: var(--white); border-top: 1px solid var(--gray-200);
    padding: 12px 28px; display: flex; align-items: center; gap: 20px;
    box-shadow: 0 -4px 14px rgba(45,90,74,0.07); z-index: 900; flex-wrap: wrap;
}
.submitbar .prog { flex: 1; min-width: 220px; max-width: 560px; }
.submitbar .prog .lbl { display: flex; justify-content: space-between; gap: 12px; font-size: 0.8rem; margin-bottom: 5px; }
.submitbar .prog .lbl .miss { color: var(--amber-600); }
.submitbar .savestate { font-size: 0.76rem; color: var(--gray-500); margin-left: auto; white-space: nowrap; }
.pbar { height: 6px; border-radius: 99px; background: var(--gray-200); overflow: hidden; display: flex; }
.pbar .fill { background: var(--forest-light); transition: width 0.3s ease; }
@media (max-width: 992px) { .submitbar { left: 0; } }

/* ===== Skeleton loading ===== */
@keyframes skel-pulse { 0% { opacity: 0.55; } 50% { opacity: 1; } 100% { opacity: 0.55; } }
.skel {
    background: var(--gray-200); border-radius: 4px;
    animation: skel-pulse 1.3s ease-in-out infinite;
    display: inline-block; height: 12px; width: 100%;
}
.skel-row { display: flex; gap: 12px; padding: 10px 16px; align-items: center; }

/* ===== Employee identity dots（實心＝管理職，空心＝專用系統帳號） ===== */
.emp-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--forest-light); margin-right: 5px; vertical-align: 1px; }
.emp-dot-outline { background: transparent; border: 1px solid var(--gray-400); }

/* ===== Login v4 (centered two-panel card, layered backdrop) ===== */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(165deg, #EDF3EF 0%, #E0EBE5 60%, #D2E3DA 100%);
    padding: 24px; position: relative; overflow: hidden;
}
.login-bg { position: absolute; inset: 0; pointer-events: none; }
.login-bg .bg-glow-1 {
    position: absolute; top: -220px; left: -160px; width: 640px; height: 640px;
    border-radius: 50%; background: radial-gradient(circle, rgba(159,225,203,0.45), transparent 70%);
}
.login-bg .bg-glow-2 {
    position: absolute; bottom: -160px; right: -120px; width: 560px; height: 560px;
    border-radius: 50%; background: radial-gradient(circle, rgba(15,110,86,0.16), transparent 70%);
}
.login-bg .bg-dots {
    position: absolute;
    background-image: radial-gradient(rgba(8,80,65,0.16) 1.2px, transparent 1.2px);
    background-size: 14px 14px;
}
.login-bg .bg-dots-tr { top: 48px; right: 64px; width: 240px; height: 140px; }
.login-bg .bg-dots-bl { bottom: 170px; left: 48px; width: 200px; height: 120px; }
.login-bg .bg-ridge { position: absolute; left: 0; width: 100%; display: block; }
.login-bg .bg-ridge-far { bottom: 38px; height: 110px; }
.login-bg .bg-ridge-near { bottom: 0; height: 84px; }
.login-shell {
    display: flex; width: 100%; max-width: 1040px; min-height: 600px;
    border-radius: 18px; overflow: hidden; background: var(--white);
    box-shadow: 0 18px 56px rgba(8, 80, 65, 0.22);
    position: relative; z-index: 1;
}
.login-brand {
    flex: 0 0 40%; background: linear-gradient(160deg, var(--forest-deepest) 0%, var(--forest-dark) 55%, var(--forest-medium) 100%);
    color: var(--white); display: flex; flex-direction: column;
    justify-content: center; align-items: center; text-align: center;
    padding: 40px 32px; position: relative; overflow: hidden;
}
.login-brand::after {
    content: ''; position: absolute; right: -60px; bottom: -60px;
    width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,0.05);
}
.login-brand::before {
    content: ''; position: absolute; left: -50px; top: -50px;
    width: 170px; height: 170px; border-radius: 50%; background: rgba(255,255,255,0.05);
}
.login-brand .brand-mark {
    width: 56px; height: 56px; border-radius: 14px; background: rgba(255,255,255,0.12);
    display: flex; align-items: center; justify-content: center; font-size: 1.7rem; margin-bottom: 20px;
}
.login-brand .brand-co { font-size: 0.88rem; opacity: 0.82; letter-spacing: 1px; margin: 0 0 6px; }
.login-brand h1 { font-size: 1.5rem; font-weight: 700; margin: 0 0 12px; letter-spacing: 1px; }
.login-brand .brand-tagline { font-size: 0.82rem; opacity: 0.75; margin: 0; letter-spacing: 0.5px; }
.login-form-side {
    flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 32px;
}
.login-form-card { width: 100%; max-width: 400px; }
.login-form-card h2 { color: var(--forest-dark); font-weight: 700; font-size: 1.4rem; margin-bottom: 4px; }
.login-form-card .subtitle { color: var(--gray-500); font-size: 0.85rem; margin-bottom: 24px; }
.pw-toggle { cursor: pointer; color: var(--gray-500); }
.pw-toggle:hover { color: var(--forest-medium); }
@media (max-width: 768px) {
    .login-shell { flex-direction: column; min-height: 0; }
    .login-brand { flex: none; flex-direction: row; gap: 12px; padding: 20px 24px; text-align: left; }
    .login-brand .brand-mark { width: 42px; height: 42px; font-size: 1.3rem; margin-bottom: 0; flex-shrink: 0; }
    .login-brand .brand-co { margin: 0; font-size: 0.74rem; }
    .login-brand h1 { font-size: 1.1rem; margin: 0; }
    .login-brand .brand-tagline { display: none; }
    .login-form-side { padding: 28px 24px; }
}

/* ===== Comment popover ===== */
.cmt-pop {
    position: absolute; z-index: 1060; background: var(--white);
    border: 1px solid var(--gray-300); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 10px; width: 240px;
}
.cmt-pop textarea { width: 100%; font-size: 0.82rem; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); padding: 6px 8px; resize: vertical; min-height: 56px; }
.cmt-pop .cmt-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
