:root {
    --primary: #0078d4;
    --primary-dark: #005a9e;
    --danger: #d13438;
    --warning: #f7630c;
    --success: #107c10;
    --gray-100: #f5f5f5;
    --gray-200: #e8e8e8;
    --gray-300: #d2d2d2;
    --gray-600: #666;
    --gray-800: #333;
    --white: #fff;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
}

.hidden { display: none !important; }

/* Login */
.login-box {
    max-width: 420px;
    margin: 12vh auto;
    text-align: center;
    padding: 3rem 2.5rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}
.login-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: var(--primary);
    color: var(--white);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 1px;
}
.login-box h1 { color: var(--gray-800); font-size: 1.5rem; margin-bottom: 0.3rem; }
.login-box h2 { color: var(--gray-600); font-weight: 400; font-size: 1rem; margin-bottom: 2rem; }
.btn-ms {
    background: var(--white);
    color: var(--gray-800);
    border: 1px solid var(--gray-300);
    gap: 0.75rem;
    font-weight: 500;
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 6px;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.btn-ms:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,120,212,0.15);
}

/* Header */
header {
    background: var(--primary);
    color: var(--white);
    padding: 0 1.5rem;
    height: 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}
.header-left { display: flex; align-items: center; gap: 0.75rem; }
.header-logo {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}
header h1 { font-size: 1.1rem; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 0.75rem; }
.btn-header { background: rgba(255,255,255,0.15); color: var(--white); border: none; }
.btn-header:hover { background: rgba(255,255,255,0.25); }

/* Avatar */
.avatar-wrapper { position: relative; cursor: pointer; }
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    user-select: none;
}
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; background: var(--primary); }

.avatar-menu {
    position: absolute;
    top: 42px;
    right: 0;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    min-width: 280px;
    z-index: 1000;
    overflow: hidden;
    color: var(--gray-800);
}
.avatar-menu-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--gray-100);
}
.avatar-info { display: flex; flex-direction: column; }
.avatar-info strong { font-size: 0.95rem; }
.avatar-info span { font-size: 0.8rem; color: var(--gray-600); }
.avatar-menu-divider { height: 1px; background: var(--gray-200); }
.avatar-menu-item {
    display: block;
    padding: 0.6rem 1.25rem;
    text-decoration: none;
    color: var(--gray-800);
    font-size: 0.9rem;
    transition: background 0.15s;
}
.avatar-menu-item:hover { background: var(--gray-100); }
.avatar-menu-logout { color: var(--danger); }
.avatar-menu-logout:hover { background: #fce8e8; }

/* Main */
main { max-width: 1200px; margin: 1.5rem auto; padding: 0 1rem; }

/* Cards */
.card {
    background: var(--white);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 1rem; color: var(--gray-800); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.2s;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--white); color: var(--white); }
.btn-outline:hover { background: rgba(255,255,255,0.1); }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 2rem; font-size: 1.1rem; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #a4262c; }
.btn-warning { background: var(--warning); color: var(--white); }

/* Forms */
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.form-group { flex: 1; min-width: 150px; margin-bottom: 0.75rem; }
.form-group label { display: block; font-size: 0.85rem; color: var(--gray-600); margin-bottom: 0.25rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 0.9rem;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0,120,212,0.2);
}
.form-actions { display: flex; align-items: center; gap: 1rem; margin-top: 0.5rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--gray-200); }
th { background: var(--gray-100); font-weight: 600; font-size: 0.85rem; color: var(--gray-600); text-transform: uppercase; }
tr:hover { background: var(--gray-100); }

/* Month Nav */
.month-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.month-nav h2 { font-size: 1.4rem; }

/* Badge */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--gray-200);
    color: var(--gray-600);
}
.badge-admin { background: var(--primary); color: var(--white); }

/* Status */
.status { font-size: 0.85rem; color: var(--success); }
.status.warning { color: var(--warning); }
.status.error { color: var(--danger); }

/* Banner */
.banner {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-weight: 500;
}
.banner-warning { background: #fff4ce; color: #835c00; border-left: 4px solid var(--warning); }

/* Tabs */
.tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 2px solid var(--gray-200); }
.tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--gray-600);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab:hover { color: var(--gray-800); }

/* Empty State */
.empty-state { text-align: center; padding: 2rem; color: var(--gray-600); }

/* Responsive */
@media (max-width: 768px) {
    header { flex-direction: row; height: auto; padding: 0.5rem 1rem; }
    .form-row { flex-direction: column; }
    .form-group { min-width: 100%; }
    .month-nav { flex-wrap: wrap; gap: 0.5rem; }
    table { font-size: 0.85rem; }
    th, td { padding: 0.4rem; }
    .avatar-menu { right: -1rem; min-width: 260px; }
}
