﻿@charset "UTF-8";

/* ==========================================================================
   1. VARIABLES & GLOBAL THEME (กำหนดตัวแปรสีม่วง-เหลือง และโครงสร้างพื้นฐาน)
   ========================================================================== */
:root {
    --mbgcolor: #BB8FCE;
    --sbgcolor: #8E44AD;
    --menu-bg: #852991;
    /* สีพื้นหลังเมนูม่วง */
    --menu-text-active: #fff026;
    /* สีตัวอักษรเหลืองสว่างเมื่อ Active/Hover */
    --menu-text-normal: #f5e6f7;
    /* สีตัวอักษรปกติ (ขาวอมม่วงจางๆ อ่านง่ายสบายตา) */
}

/* Scope ด้วย :has(.app-container) เพราะ index.html โหลด master.css และ eform.css แบบ global
   ทั้งคู่ (ทุกหน้า) — ถ้าใช้ selector "body" เฉยๆ จะไปทับ body{...} ของ eform.css (ที่ตั้ง font/พื้นหลัง
   สำหรับหน้าใบลา A4 แบบ standalone) เพราะ master.css ถูก <link> ไว้หลัง eform.css ใน index.html เสมอชนะ
   .app-container มีเฉพาะหน้า dashboard ที่ครอบด้วย MainLayoutComponent เท่านั้น หน้า eform-* (standalone,
   ไม่ครอบด้วย layout) จะไม่มี .app-container จึงไม่โดน rule นี้ */
body:has(.app-container) {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #F3F4F6;
}

/* ล้างขีดเส้นใต้ของลิงก์ยึดตามระบบเดิม */
a,
a:hover,
a:focus {
    text-decoration: none !important;
}

.app-container {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* หน้าคู่มือ (/manual): สารบัญและแถบตัวกรองใช้ position: sticky ซึ่งยึดกับ .body-content (overflow-y: auto)
   — ต้องให้ .body-content เป็นตัวเลื่อนจริง จึงล็อกความสูงเฉพาะหน้านี้ (หน้าอื่นยังเลื่อนทั้งหน้าเหมือนเดิม) */
.app-container:has(app-manual) {
    height: 100vh;
}

/* พิมพ์หน้าคู่มือ (ปุ่ม "พิมพ์เฉพาะภาคนี้" ของภาค API): ปลดความสูง/ตัวเลื่อนข้างบน ไม่งั้นพิมพ์ได้แค่หน้าจอเดียว
   และใช้ named page ให้มีขอบกระดาษ (@page ของ eform.css ตั้ง margin 0 ไว้สำหรับฟอร์ม A4) */
@page hrm-manual {
    size: A4;
    margin: 1.5cm 1.5cm 1.5cm 1.5cm;
}

@media print {
    .app-container:has(app-manual),
    .app-container:has(app-manual) .main-wrapper,
    .app-container:has(app-manual) .body-content {
        display: block;
        height: auto;
        overflow: visible;
        padding: 0;
    }

    /* .sidebar / .top-header ของ master.css (โหลดหลัง eform.css) ทับ .no-print ของ eform.css — ซ่อนให้เองบนหน้านี้ */
    .app-container:has(app-manual) .no-print {
        display: none !important;
    }

    app-manual {
        page: hrm-manual;
    }
}

/* พิมพ์หน้า Data Dictionary (config-datadict): แบบเดียวกับหน้าคู่มือ — ปลดตัวเลื่อน ซ่อนแถบข้าง/บน ใช้ขอบกระดาษของตัวเอง */
@page hrm-datadict {
    size: A4;
    margin: 1.2cm 1.2cm 1.2cm 1.2cm;
}

@media print {
    .app-container:has(app-config-datadict),
    .app-container:has(app-config-datadict) .main-wrapper,
    .app-container:has(app-config-datadict) .body-content {
        display: block;
        height: auto;
        overflow: visible;
        padding: 0;
    }

    .app-container:has(app-config-datadict) .no-print {
        display: none !important;
    }

    app-config-datadict {
        page: hrm-datadict;
    }

    /* ภาพ ER (SVG ของ mermaid ใส่ผ่าน innerHTML — style ของ component ไปไม่ถึง) ที่สูงเกินหน้า A4 ถูก Chrome ตัดทิ้ง
       — ย่อให้พอดีหน้า ความกว้างคงสัดส่วนเอง */
    app-config-datadict .er-svg svg {
        max-height: 250mm;
    }
}

/* ==========================================================================
   2. BREADCRUMB STYLES (ส่วนแสดงตำแหน่งเมนูด้านบนซ้าย)
   ========================================================================== */
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.breadcrumb-container {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.breadcrumb-main {
    color: var(--menu-bg, #852991);
}

.breadcrumb-sep {
    margin: 0 10px;
    font-size: 12px;
    color: #9CA3AF;
}

.breadcrumb-sub {
    color: #4B5563;
}

/* ==========================================================================
   3. SIDEBAR LAYOUT & LOGO (แผงเมนูด้านซ้ายและระบบจัดการความกว้าง)
   ========================================================================== */
.sidebar {
    width: 260px;
    min-width: 260px;
    flex-shrink: 0;
    background-color: var(--menu-bg);
    color: var(--menu-text-normal);
    transition: width 0.3s ease, min-width 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar.collapsed {
    width: 70px;
    min-width: 70px;
}

.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background-color: #6c2076;
    white-space: nowrap;
    overflow: hidden;
    transition: padding 0.3s ease;
}

.sidebar-header a {
    display: flex;
    align-items: center;
    text-decoration: none;
    width: 100%;
}

.sidebar-logo {
    height: 60px;
    width: 60px;
    border-radius: 5px;
    object-fit: fill;
    margin-right: 15px;
    transition: margin 0.3s ease;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #FFFFFF;
}

.sidebar.collapsed .sidebar-title {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    padding: 0;
}

.sidebar.collapsed .sidebar-header a {
    justify-content: center;
}

.sidebar.collapsed .sidebar-logo {
    margin-right: 0;
}

/* ==========================================================================
   4. CUSTOM SIDEBAR MENU (ระบบรายการเมนูหลัก/ย่อย และไอคอนไดนามิก)
   ========================================================================== */
.sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px 0;
}

.sidebar-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu>ul>li {
    margin: 4px 12px;
}

.sidebar-menu>ul>li>a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--menu-text-normal);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar-menu>ul>li>a:hover {
    background-color: #73227e;
    color: var(--menu-text-active);
}

.sidebar-menu>ul>li>a.menu-toggle::after {
    content: "❯";
    margin-left: auto;
    font-size: 11px;
    color: var(--menu-text-normal);
    transition: transform 0.3s ease;
}

.sidebar-menu>ul>li.open>a.menu-toggle::after {
    transform: rotate(90deg);
    color: var(--menu-text-active);
}

.sidebar-menu>ul>li>a.active-parent-link {
    color: var(--menu-text-active) !important;
    background-color: rgba(0, 0, 0, 0.2) !important;
    text-shadow: 0 0 0.5px var(--menu-text-active);
}

.sidebar-menu>ul>li>a.active-parent-link::after {
    color: var(--menu-text-active) !important;
}

.sidebar-menu .sub-menu {
    padding: 4px 0 4px 10px;
    margin-top: 4px;
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

.sidebar-menu .sub-menu li {
    margin: 0;
}

.sidebar-menu .sub-menu li a {
    display: block;
    padding: 10px 16px 10px 30px;
    color: var(--menu-text-normal);
    font-size: 14px;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar-menu .sub-menu li a:hover {
    color: var(--menu-text-active);
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-menu .sub-menu li.active-sub-item>a {
    color: var(--menu-text-active) !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    text-shadow: 0 0 0.5px var(--menu-text-active);
}

.sidebar-menu .menu-icon {
    margin-right: 15px;
    font-size: 18px;
    display: inline-block;
    transition: margin 0.3s ease;
}

.sidebar-menu .menu-text {
    display: inline-block;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-menu>ul>li>a {
    padding: 12px 0;
    justify-content: center;
}

.sidebar.collapsed .sidebar-menu .menu-text {
    display: none !important;
}

.sidebar.collapsed .sidebar-menu .menu-icon {
    margin-right: 0 !important;
    font-size: 20px;
}

.sidebar.collapsed .sidebar-menu>ul>li>a::after {
    display: none !important;
}

.sidebar.collapsed .sidebar-menu .sub-menu {
    display: none !important;
}

/* ==========================================================================
   5. MAIN CONTENT & HEADERS (แถบขวา, ข้อมูลผู้ใช้ และระบบ Scrollbar เดี่ยว)
   ========================================================================== */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-header {
    height: 70px;
    background-color: #FFFFFF;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 900;
}

.btn-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #4B5563;
}

/* --- ระบบ Dropdown เมนูผู้ใช้แบบใหม่ --- */
.top-user-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.user-dropdown-container {
    position: relative;
    display: inline-block;
}

.user-name-trigger {
    color: #374151;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 6px;
    background-color: #F3F4F6;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.user-name-trigger:hover {
    background-color: #E5E7EB;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background-color: #ffffff;
    min-width: 180px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 8px 0;
    list-style: none;
    z-index: 1000;

    /* Animation ซ่อนก่อน Hover */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

/* เมื่อ Hover ที่กล่องแม่ ให้แสดงกล่องลูก */
.user-dropdown-container:hover .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-menu li {
    margin: 0;
    padding: 0;
}

.user-dropdown-menu a {
    display: block;
    padding: 10px 20px;
    color: #4b5563;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s;
    cursor: pointer;
}

.user-dropdown-menu a:hover {
    background-color: #f3f4f6;
    color: var(--menu-bg, #852991);
}

/* สีแดงสำหรับปุ่มออกจากระบบ */
.user-dropdown-menu a.text-danger:hover {
    background-color: #fef2f2;
    color: #dc2626;
}

.body-content {
    padding: 25px;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: auto;
    background-color: #FFFFFF;
}

/* หน้าเพจห่อเนื้อหาด้วย .body-content ซ้ำอีกชั้นใน <main class="body-content"> ของ layout
   — ตัดระยะบนของชั้นใน ไม่ให้ห่างจากแถบด้านบนเป็นสองเท่า */
main.body-content {
    padding-top: 15px;
}

.body-content .body-content {
    padding-top: 0;
}

.footer-content {
    background-color: #FFFFFF;
    padding: 15px 25px;
    text-align: center;
    font-size: 13px;
    color: #6B7280;
    border-top: 1px solid #E5E7EB;
}

/* ==========================================================================
   6. ORIGINAL UTILITIES & FORM FIELDS (คลาสจัดการฟอร์มและตารางดั้งเดิมของคุณ)
   ========================================================================== */
.container {
    width: 97%;
    margin-right: auto;
    margin-left: auto;
}

input {
    font-size: 16px;
    height: 35px;
}

input[type="text"] {
    border: 1px solid blue;
    border-radius: 6px;
    outline: none;
    box-shadow: rgba(225, 228, 232, 0.2) 0px 1px 0px 0px inset;
    padding: 10px;
    box-sizing: border-box;
}

input[type="text"]:focus {
    border-color: #0366d6;
    outline: none;
    box-shadow: rgba(3, 102, 214, 0.3) 0px 0px 0px 3px;
}

input[type="password"] {
    border: 1px solid blue;
    border-radius: 6px;
    outline: none;
    box-shadow: rgba(225, 228, 232, 0.2) 0px 1px 0px 0px inset;
    padding: 10px;
    box-sizing: border-box;
}

input[type="password"]:focus {
    border-color: #0366d6;
    outline: none;
    box-shadow: rgba(3, 102, 214, 0.3) 0px 0px 0px 3px;
}

textarea {
    font-size: 16px;
    border-radius: 6px;
    border: 1px solid blue;
}

input[type="submit"] {
    display: inline-block;
    outline: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    border-radius: 500px;
    transition-property: background-color, border-color, color, box-shadow, filter;
    transition-duration: .3s;
    border: 1px solid transparent;
    letter-spacing: 2px;
    min-width: 100px;
    text-transform: uppercase;
    white-space: normal;
    font-weight: 700;
    text-align: center;
    padding: 10px 20px;
    height: 35px;
}

input[type="submit"]:hover {
    transform: scale(1.04);
}

select {
    background-color: aqua;
    font-size: 16px;
    height: 35px;
    border: none;
    border-radius: 0.5em;
    display: inline-block;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    width: 100%;
}

select option {
    list-style: none;
    position: absolute;
    top: 3.2em;
    width: 100%;
    border-radius: 0.5em;
}

select option:hover {
    background: #1d1f24;
    cursor: pointer;
}

.table .tr .td {
    vertical-align: top;
}

.imgcant {
    width: 100%;
    height: auto;
    display: block;
}

/* --- สไตล์สำหรับ CheckBox ที่ซ่อน --- */
.chkslide input[type="checkbox"] {
    width: 1.3rem;
    height: 1.3rem;
    position: absolute;
    opacity: 0;
}

.chkslide input[type="checkbox"]+label {
    display: inline-block;
    border: 2px solid rgba(139, 139, 139, 0.3);
    border-radius: 25px;
    white-space: nowrap;
    padding: 8px 12px;
    margin: 2px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    font-size: 14px;
}

.chkslide input[type="checkbox"]+label::before {
    content: "X";
    display: inline-block;
    font-size: 12px;
    padding: 2px 6px 2px 2px;
    transition: transform 0.3s ease-in-out;
}

.chkslide input[type="checkbox"]:checked+label {
    border: 2px solid #1bdbf8;
    background-color: #12bbd4;
    color: #fff;
    transition: all 0.2s;
}

.chkslide input[type="checkbox"]:checked+label::before {
    content: "√";
    transform: rotate(-360deg);
}

.chkslide input[type="checkbox"]:focus+label {
    border: 2px solid #e9a1ff;
}

.btn {
    border: 1px solid transparent;
    border-radius: 500px;
    padding: 10px 20px;
    font-weight: 700;
    cursor: pointer;
}

.btn-add {
    background-color: greenyellow;
}

.btn-edit {
    background-color: gold;
}

.btn-del {
    background-color: lightcoral;
}

.btn-search {
    background-color: lightblue;
}

/* --- ระบบตารางข้อมูล (Grid Components) --- */
.grid {
    overflow: visible;
    border: none;
    vertical-align: top;
    width: 100%;
}

.grid tr th {
    background-color: LightGray;
    padding: 5px 10px;
    font-size: 18px;
}

.grid td {
    padding: 5px 10px;
    font-size: 18px;
}

.grid td img {
    margin-top: 0rem;
    margin-bottom: -0.3rem;
}

.gridbg tr:nth-child(even) {
    background-color: #FCF5FF;
}

.gridbg tr:nth-child(odd) {
    background-color: white;
}

.gridth tr th {
    white-space: nowrap;
}

.gridtd tr td {
    white-space: nowrap;
}

.ModalPopupBG {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   11. LEAVES DETAIL (Legacy-like layout)
   ========================================================================== */
.leaves-page {
    padding: 12px 16px 20px;
    color: #111;
    background: #fff;
    font-size: 13px;
}

.title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.title-text {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.employee-name {
    background: #98ef3d;
    border: 1px solid #4ca600;
    border-radius: 4px;
    min-width: 320px;
    padding: 4px 10px;
    font-weight: 700;
    display: inline-block;
}

.vacation-base-btn {
    border: 1px solid #e07d5f;
    background: #ffb59a;
    border-radius: 999px;
    font-size: 12px;
    padding: 4px 10px;
    color: #5b2100;
}

.search-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 8px;
    max-width: 530px;
}

.search-field {
    display: grid;
    gap: 4px;
    flex: 1;
}

.search-field label {
    font-size: 12px;
    font-weight: 700;
}

.search-btn {
    border: 1px solid #373737;
    background: #f8f8f8;
    border-radius: 2px;
    padding: 6px 12px;
    height: 38px;
    font-size: 12px;
    font-weight: 700;
}

.panel-table {
    overflow-x: auto;
    border: 1px solid #a9a9a9;
}

.legacy-calendar {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.legacy-calendar th,
.legacy-calendar td {
    border: 1px solid #bcbcbc;
}

.legacy-calendar th {
    text-align: center;
    font-size: 12px;
    padding: 4px;
    background: #ffffff;
}

.legacy-calendar .head-sun,
.legacy-calendar .head-sat {
    background: #ffc8dc;
}

.calendar-cell {
    vertical-align: top;
    padding: 0;
    background: #fff;
}

.calendar-cell.empty-cell {
    background: #fcfcfc;
}

.day-title {
    line-height: 20px;
    padding: 0 4px;
    font-size: 11px;
    font-weight: 700;
    background: #7a7a7a;
    color: #fff;
}

.day-weekend {
    background: #fff;
    color: #cc1f1f;
}

.day-holiday {
    background: #ffc8dc;
    color: #cc1f1f;
}

.holiday-text {
    font-weight: 500;
}

.entry-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px;
}

.entry-item {
    border: 1px solid #000;
    color: #111;
    font-size: 11px;
    line-height: 1.2;
    padding: 1px 3px;
}

.entry-group-title {
    font-weight: 700;
    padding: 1px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.4);
}

.entry-item .entry-line {
    padding: 1px 0;
}

.entry-item .entry-line + .entry-line {
    border-top: 1px solid rgba(0, 0, 0, 0.25);
}

.schedule-table,
.summary-table,
.vacation-table,
.history-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.schedule-table th,
.schedule-table td,
.summary-table th,
.summary-table td,
.vacation-table th,
.vacation-table td,
.history-table th,
.history-table td {
    border: 1px solid #bcbcbc;
    text-align: center;
    padding: 3px;
}

.schedule-table th,
.summary-table th,
.vacation-table th,
.history-table th {
    font-size: 11px;
    background: #ececec;
}

.schedule-type,
.schedule-label {
    width: 80px;
    background: #f5f5f5;
    font-weight: 700;
}

.schedule-holiday {
    color: #c01717;
    background: #ffe4e4;
}

.schedule-leave {
    color: #037641;
    background: #d9ffe7;
}

.schedule-training {
    color: #004f95;
    background: #dff1ff;
}

.leave-form {
    container-type: inline-size;
    margin-top: 8px;
    border: 1px solid #bcbcbc;
    padding: 12px;
    background: #fff;
}

.field-row {
    display: grid;
    grid-template-columns: 125px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

/* จับ .field-row สองแถวมาวางคู่กันในบรรทัดเดียว (ฟอร์มการลา หน้า leaves-detail)
   ใช้คอลัมน์ label 125px เท่ากับแถวเดี่ยว ช่องกรอกจึงเริ่มตรงแนวเดียวกัน
   minmax(0,1fr) กัน <select> ที่กว้างตามชื่อ-สกุลที่ยาวที่สุดดันกริดจนล้นออกนอกกรอบ */
.field-row-pair {
    display: grid;
    /* ฝั่งซ้ายกว้างกว่าครึ่งอยู่ 17.5px = (label ซ้าย 125px - label ขวา 90px) / 2
       ให้ช่อง select ทั้งสองฝั่งกว้างเท่ากัน — ถ้าเปลี่ยนความกว้าง label ต้องคำนวณค่านี้ใหม่ */
    grid-template-columns: minmax(0, calc((100% - 12px) / 2 + 17.5px)) minmax(0, 1fr);
    gap: 8px 12px;
    margin-bottom: 8px;
}

.field-row-pair>.field-row {
    grid-template-columns: 125px minmax(0, 1fr);
    margin-bottom: 0;
}

/* ช่องฝั่งขวาของคู่ (ผู้ปฏิบัติงานแทน / ผู้มีอำนาจอนุญาต) label สั้นกว่า ใช้คอลัมน์แคบลง ให้ select ได้ที่มากขึ้น */
.field-row-pair>.field-row+.field-row {
    grid-template-columns: 90px minmax(0, 1fr);
}

.field-row-pair .form-select,
.field-row-pair .form-control {
    max-width: 100%;
}

.field-row>label {
    font-weight: 700;
    font-size: 16px;
}

.field-control.with-inline-check {
    display: grid;
    grid-template-columns: minmax(190px, 300px) auto auto;
    gap: 12px;
    align-items: center;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #bf2200;
    font-weight: 700;
    font-size: 12px;
}

.dual-date {
    display: grid;
    grid-template-columns: repeat(5, auto);
    justify-content: start;
    align-items: center;
    gap: 8px 12px;
}

.date-item {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 4px;
}

.date-item>span {
    white-space: nowrap;
    font-size: 12px;
}

/* ช่องวันที่ในแถววันที่ลา — กว้างพอดีกับ "2569-10-06" + ไอคอน ไม่ยืดเต็มคอลัมน์ grid */
.date-item .app-datepicker {
    width: 130px !important;
}

/* สไตล์ของ .app-datepicker / .app-clockpicker (ไอคอนปฏิทิน, เคอร์เซอร์) มาจาก @kengcom202/kcore-ui แล้ว */

.time-item {
    max-width: 220px;
}

/* ช่องจำนวนวันลามีสองตำแหน่ง: ท้ายแถววันที่ลา เมื่อกรอบฟอร์มกว้างพอ
   ไม่งั้นย้ายไปท้ายแถว "ในระหว่างการลาสามารถติดต่อที่" กันล้นกรอบ (960px = ความกว้างที่แถววันที่ลาวางครบ 5 ช่อง) */
.days-in-date {
    display: none;
}

@container (min-width: 960px) {
    .days-in-date {
        display: grid;
    }

    .days-in-contact {
        display: none;
    }
}

.leave-total-wrap {
    display: grid;
    grid-template-columns: minmax(180px, 260px) auto;
    gap: 8px;
}

.submit-btn {
    border: 1px solid #2e9900;
    background: #7dff4c;
    border-radius: 999px;
    color: #0f4f00;
    font-weight: 700;
    padding: 6px 16px;
    justify-self: start;
}

.submit-btn:disabled {
    opacity: 0.6;
}

.pass-days-box {
    margin-top: 8px;
    border: 1px solid #f2d48d;
    background: #fff7df;
    padding: 8px;
}

.pass-days-title {
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 16px;
}

.vacation-remain-box {
    margin-top: 8px;
    border: 1px solid #84caf6;
    background: #ebf8ff;
    padding: 8px;
    font-size: 14px;
}

.vacation-label {
    color: #046aa8;
    font-weight: 700;
    margin-right: 6px;
}

.history-type {
    color: #0a56ad;
    font-weight: 700;
}

.status-icons {
    white-space: nowrap;
}

.status-icons img {
    margin-right: 2px;
}

.action-col {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.action-col button {
    border: 1px solid #b4b4b4;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    color: #111;
}

.btn-danger {
    background: #ffdcdc;
}

.btn-warning {
    background: #fff2c3;
}

.btn-info {
    background: #dff4ff;
}

.empty-message {
    color: #666;
    padding: 10px;
    text-align: center;
}

.mt-2 {
    margin-top: 8px;
}

@media (max-width: 992px) {
    .field-row {
        grid-template-columns: 1fr;
        align-items: start;
    }

    /* จอแคบ: แยกคู่กลับเป็นแถวละช่อง (ต้อง reset ซ้ำเพราะ .field-row-pair>.field-row
       specificity สูงกว่า .field-row ด้านบน) */
    .field-row-pair,
    .field-row-pair>.field-row,
    .field-row-pair>.field-row+.field-row {
        grid-template-columns: 1fr;
    }

    .field-row-pair>.field-row {
        margin-bottom: 8px;
    }

    .field-control.with-inline-check {
        grid-template-columns: 1fr;
    }

    .dual-date {
        grid-template-columns: 1fr;
    }

    .leave-total-wrap {
        grid-template-columns: 1fr;
    }

    .employee-name {
        min-width: 0;
        width: 100%;
    }
}

.popup-content {
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
}

.popup-header {
    background-color: #BB8FCE;
    color: #fff;
    padding: 12px 20px;
    font-weight: bold;
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- ระบบกล่องและฟอร์มดีไซน์ --- */
.center-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f5f5f5;
}

.form-container {
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}

.form-container-box {
    position: relative;
    width: 300px;
    height: 500px;
    max-width: 90%;
    overflow: hidden;
}

.form-container h2 {
    text-align: center;
    color: #0000FF;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label::after {
    content: " : ";
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    text-align: left;
    font-size: 16px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    box-sizing: border-box;
}

.form-group input[type="file"] {
    padding: 3px;
}

.form-group-inline {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
}

.inline-item {
    display: flex;
    flex-direction: column;
    margin-top: auto;
}

.inline-item label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    text-align: left;
    font-size: 16px;
}

.inline-item label::after {
    content: " : ";
}

.inline-flex {
    flex: 1;
}

.inline-request {}

.inline-request label {
    color: red;
    font-weight: bold;

}

.inline-request label::after {
    content: " * : ";
}

.inline-request input[type="text"] {
    border: 2px solid red;
}

.inline-input {
    width: 100%;
}

.button-group {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.button-group button {
    margin: 0 10px;
}

.alert {
    color: #FF3300;
    margin-top: 15px;
    text-align: center;
}

.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    z-index: 0;
    opacity: 0.3;
}

.content-overlay {
    position: relative;
    z-index: 1;
    height: 100%;
}

.span-employee-name {
    background-color: greenyellow;
    padding: 5px 15px;
    border-radius: 5px;
    border: 1px solid #ccc;
    flex-grow: 1;
    font-size: 20px !important;
}

.label-top {
    position: absolute;
    font-size: 40px;
    color: #333;
    text-decoration: none;
}

.label-top-center {
    position: absolute;
    top: 0px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    padding: 4px 30px;
    border: 2px solid #ccc;
    border-radius: 15px;
    background-color: #f9f9f9;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 10;
    width: auto;
    max-width: 90%;
}

.label-bottom {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 14px;
    color: #333;
}

.readonly {
    background-color: #ffd8d8;
    cursor: not-allowed;
}