/* ระบบภายในบริษัท Magnet Group - ออกแบบให้ใช้งานง่ายที่สุด ตัวอักษรใหญ่ ปุ่มใหญ่ */
/* โทนสีอ้างอิงจากเว็บ J&T Express Thailand (แดง-ขาว) เพราะ Magnet Group เป็นพาร์ทเนอร์ขนส่ง J&T */
:root {
    --jt-red: #e60000;
    --jt-red-dark: #b30000;
    --jt-red-tint: #fdeaea;
}
* { box-sizing: border-box; }
body {
    font-family: "Sarabun", "Tahoma", sans-serif;
    background: #f2f4f7;
    margin: 0;
    color: #222;
    font-size: 18px;
}
.topbar {
    background: #fff;
    color: #222;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 4px solid var(--jt-red);
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}
.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.brand-mark-img {
    height: 48px;
    width: auto;
    flex-shrink: 0;
}
.brand-tagline {
    color: #777;
    font-size: 13px;
    line-height: 1.3;
    border-left: 2px solid #eee;
    padding-left: 12px;
    margin-left: 4px;
}
.topbar-btn {
    background: var(--jt-red);
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 999px;
    transition: 0.15s;
}
.topbar-btn:hover { background: var(--jt-red-dark); }
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.logout-form { margin: 0; }
.layout {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
}
.sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #fff;
    min-height: calc(100vh - 78px);
    padding: 20px 0;
    box-shadow: 1px 0 6px rgba(0,0,0,0.06);
}
.sidebar-link {
    display: block;
    padding: 14px 24px;
    color: #444;
    text-decoration: none;
    font-size: 16px;
    font-weight: bold;
    border-left: 4px solid transparent;
}
.sidebar-link:hover { background: var(--jt-red-tint); }
.sidebar-link.active {
    color: var(--jt-red);
    border-left-color: var(--jt-red);
    background: var(--jt-red-tint);
}
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}
.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 24px 0;
}
.nav-btn {
    display: block;
    background: #fff;
    border: 3px solid var(--jt-red);
    border-radius: 14px;
    padding: 28px 12px;
    text-align: center;
    text-decoration: none;
    color: var(--jt-red);
    font-size: 22px;
    font-weight: bold;
    transition: 0.15s;
}
.nav-btn:hover {
    background: var(--jt-red);
    color: #fff;
}
.card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.card h2 { margin-top: 0; }
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 17px;
}
th, td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}
th { background: var(--jt-red-tint); }
tr:nth-child(even) { background: #fafafa; }
.btn {
    display: inline-block;
    padding: 12px 22px;
    border-radius: 8px;
    border: none;
    background: var(--jt-red);
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--jt-red-dark); }
.btn-secondary { background: #757575; }
.btn-secondary:hover { background: #545454; }
.btn-danger { background: var(--jt-red-dark); }
.btn-small { padding: 6px 12px; font-size: 14px; }
.employee-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
}
.employee-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    text-decoration: none;
    color: #222;
    display: block;
    transition: 0.15s;
    border: 1px solid #eee;
}
.employee-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.16);
    transform: translateY(-2px);
}
.employee-photo-wrap {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: var(--jt-red-tint);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.employee-photo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.employee-photo-placeholder {
    font-size: 48px;
    color: var(--jt-red);
    opacity: 0.5;
}
.employee-card-body {
    padding: 12px 14px;
}
.employee-card-code {
    font-size: 13px;
    color: #888;
}
.employee-card-name {
    font-size: 17px;
    font-weight: bold;
    margin: 2px 0 4px;
    line-height: 1.25;
}
.employee-card-position {
    font-size: 14px;
    color: #555;
    margin-bottom: 8px;
    min-height: 1.2em;
}
.employee-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: bold;
    padding: 3px 10px;
    border-radius: 999px;
}
.employee-badge-active { background: #d4edda; color: #155724; }
.employee-badge-probation { background: #fff3cd; color: #856404; }
.employee-badge-inactive { background: #f8d7da; color: #721c24; }
form label {
    display: block;
    margin-top: 14px;
    font-weight: bold;
}
form input, form select, form textarea {
    width: 100%;
    padding: 10px;
    font-size: 17px;
    margin-top: 4px;
    border: 1px solid #ccc;
    border-radius: 6px;
}
form .checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}
form .checkbox-row input { width: auto; }
.form-actions { margin-top: 20px; }
.flash {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: bold;
}
.flash-success { background: #d4edda; color: #155724; }
.flash-danger { background: #f8d7da; color: #721c24; }
.flash-warning { background: #fff3cd; color: #856404; }
.summary-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.summary-box .item {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.summary-box .item .num {
    font-size: 32px;
    font-weight: bold;
    color: var(--jt-red);
}
.search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-row input, .search-row select {
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
}
.back-link {
    display: inline-block;
    margin-bottom: 16px;
    color: var(--jt-red);
    text-decoration: none;
    font-weight: bold;
}
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f2f4f7;
}
.login-box {
    width: 100%;
    max-width: 360px;
    text-align: center;
}
.login-logo {
    height: 48px;
    margin-bottom: 12px;
}
.login-box h2 {
    margin-top: 0;
}
.login-box form {
    text-align: left;
}
.login-box .btn {
    width: 100%;
}
.payslip-sheet {
    max-width: 600px;
    margin: 0 auto;
}
@media print {
    .topbar, .sidebar, .no-print, .flash { display: none !important; }
    .layout, .container { max-width: 100%; margin: 0; padding: 0; display: block; }
    body { background: #fff; }
    .card { box-shadow: none; }
}
