:root {
    --accent: #DE5C8E;
    --accent-dark: #F8E1EA;
    --accent-light: #fff0f5; /* เพิ่มตัวแปรที่ขาดไป */
    --bg: #F8E1EA;
    --card: #f8f5f5;
    --muted-text: #504e4e;
}

/* reset-ish */
* { 
    box-sizing: border-box; 
}

body {
    margin: 0;
    font-family: "CHULACHARAS NEW", "CHULALONGKORN", "Segoe UI", Tahoma, sans-serif;
    background: var(--bg);
    color: #222;
}

/* HEADER */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* กระจายซ้าย กลาง ขวา */
    background: linear-gradient(90deg, var(--accent-dark), var(--accent));
    color: white;
    padding: 10 20px;
    height: 100px;
    position: relative; /* เพื่อรองรับการจัดวางภายใน */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.brand {
    flex: 2;
    text-align: center;
    font-size: 1.7rem;
    font-weight: bold;
    white-space: nowrap;
}

.header-left {
    flex: 1; /* กินพื้นที่ฝั่งซ้ายเพื่อให้ชื่อระบบอยู่ตรงกลางจริงๆ */
    display: flex;
    align-items: center;
}

.header-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end; /* ดันเนื้อหาทั้งหมด (ชื่อ+เวลา+โลโก้) ชิดขอบล่าง */
    gap: 15px;            /* ระยะห่างจากโลโก้ */
    padding-right: 15px;   /* ขยับออกจากขอบขวา ไม่ให้ติดเกินไป */
    padding-bottom: 0px;   /* ระยะห่างจากขอบล่างของ Header */
}

.header-logo {
    height: 95px; /* ปรับขนาดให้พอดี */
    width: auto;
    object-fit: contain;
    border-radius: 4px;
}

.btn-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
}

/* LAYOUT & SIDEBAR */
.main { 
    display: flex; 
    min-height: calc(100vh - 96px); 
}

.sidebar{
    width:240px;
    /*background:#232b2a;*/
    background:#58595B;
    color:#fff;
    padding:14px 10px;
}
.menu{
    display:flex;
    flex-direction:column;
    gap:8px;
    padding:8px
}
.sidebar a{
    display:flex;
    align-items:center;
    gap:12px;
    padding:10px 12px;
    border-radius:8px;
    color:#fff;
    text-decoration:none;
    transition: .15s;
}
/*.sidebar a:hover{background:#2f3a39}*/
.sidebar a:hover{
    background:#DE5C8E
}
.sidebar a.active{
    background:var(--accent);
    color:#F8E1EA
}

/* SUBMENU with pink left bar */
.dropdown{
    position:relative
}

.dropdown-menu{
    display:none;
    flex-direction:column;
    background:#2f3a39;
    margin-left:36px;
    border-left:4px solid var(--accent);
    border-radius:0 0 8px 8px;
    overflow:hidden;
}

.dropdown:hover .dropdown-menu{
    display:flex
}

.dropdown-menu a{
    padding:8px 12px;
    color:#e6efe6;
    text-decoration:none
}

.dropdown-menu a:hover{
    background:#DE5C8E
}

/* CONTENT & CARDS */
.content { 
    flex: 1; 
    padding: 26px; 
}

/* Dashboard header */
.page-title{
    font-size:22px;
    margin:0 0 6px 0
}

.page-sub{
    color:var(--muted-text);
    margin:0 0 18px 0
}

.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 18px; 
    margin-bottom:18px;
}

.card {
    background: var(--card);
    padding: 18px;
    border-radius: 12px;
    border:1px solid #58595B;
    box-shadow: 0 6px 20px rgba(15,20,15,0.04);
    transition: .18s;
}

.card:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 10px 28px rgba(15,20,15,0.07); 
}

.card .icon{
    font-size:30px;
    color:var(--accent);
    margin-bottom:8px
}
.card .label{
    font-weight:700;
    color:#58595B
}
.card .value{
    font-size:28px;
    color:var(--accent);
    margin-top:6px
}

/* LOGIN SECTION */
.login-wrapper {
    display: flex; 
    justify-content: center; 
    align-items: center;
    min-height: 80vh; 
    padding: 20px;
}

.login-box {
    background: #f8f5f5; 
    padding: 40px; 
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%; 
    max-width: 400px;
    border-top: 5px solid var(--accent);
}

.input-field {
    width: 100%; 
    padding: 12px; 
    border: 1px solid #504e4e;;
    border-radius: 8px; 
    margin-top: 8px; 
    margin-bottom: 15px;
}

.btn-submit {
    width: 100%; 
    padding: 12px; 
    background: var(--accent);
    color: rgb(252, 252, 252); 
    border: none; 
    border-radius: 8px;
    font-weight: bold; 
    cursor: pointer; 
    transition: 0.3s;
}

.btn-submit:hover { 
    background: #C3002F; 
}

.btn-reset {
    width: 100%; 
    padding: 12px; 
    background: var(--accent-dark);
    color: #C3002F; 
    border: none; 
    border-radius: 8px;
    font-weight: bold; 
    cursor: pointer; 
    transition: 0.3s;
}

.btn-reset:hover { 
    background: #C3002F;
    color: var(--accent-light); 
}

/* section blocks */
.section{
    margin-top:18px;
}

/* tables (clean, compact) */
.table{
    width:100%;
    border-collapse:collapse;
    margin-top:10px;
}
.table th, .table td{
    text-align:left;
    padding:10px 8px;
    border-bottom:1px solid #fff;
}
.table thead th{
    background: #DE5C8E;
    font-weight:700;
    color:#333;
}

/* TABS */
.tab-container { 
    display: flex; 
    gap: 5px; 
    border-bottom: 2px solid var(--accent); 
    margin-top: 20px; 
}

.tab-item {
    padding: 12px 25px; 
    text-decoration: none; 
    color: #58595B;
    font-weight: bold; 
    border-radius: 8px 8px 0 0; 
    transition: 0.3s;
}

.tab-item.active { background: var(--accent); 
    color: white; 
}

.tab-content {
    display: none !important;
}

.tab-content.active {
    display: block !important;
}

@keyframes fadeEffect {
    from {opacity: 0;}
    to {opacity: 1;}
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.quick-btn {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: 0.2s;
}

.quick-btn i {
    margin-right: 12px;
    color: var(--accent); /* ใช้สีชมพูคณะตามที่คุณตั้งไว้ */
    font-size: 18px;
}

.quick-btn:hover {
    background: var(--accent-dark); /* สีชมพูอ่อนที่ตั้งไว้ใน :root */
    border-color: var(--accent);
}

/* RESPONSIVE */
@media(max-width:900px){
    .main { flex-direction: column; }
    .sidebar { width: 100%; }
    .quick-grid { grid-template-columns: repeat(2, 1fr); }
}

/* latest users list */
.latest-box{
    background:var(--card);
    padding:16px;
    border-radius:12px;
    border:1px solid #F8E1EA;
    box-shadow:0 6px 18px rgba(57, 116, 183, 0.03);
}
.user-row{
    display:flex;
    gap:12px;
    align-items:center;
    padding:10px;
    border-radius:8px;
    /*background:linear-gradient(180deg,#fbfff9,#f8fff6);*/
    background:linear-gradient(180deg,#F8E1EA,#ffffff);
    border:1px solid #fcc5da;
    margin-bottom:10px
}
.user-avatar{
    width:44px;
    height:44px;
    border-radius:50%;
    background:var(--accent);
    display:flex;
    align-items:center;
    justify-content:center;
    color:#fff;
    font-weight:700
}

.user-profile {
    padding: 20px 15px;
    text-align: center;
    color: white;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.user-name {
    font-family: 'CHULACHARAS NEW', sans-serif;
    font-weight: bold;
    font-size: 16px;
    display: block;
    margin-bottom: 5px;
}

.user-date, .user-time {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* announce */
.announce{
    margin-top:18px;
    padding:14px;
    border-radius:12px;
    background:linear-gradient(120deg,#DE5C8E,#F8E1EA);
    border-left:6px solid var(--accent);
    color:var(--accent-dark)
}

/* footer */
.footer{
    margin-top:18px;
    text-align:center;
    color:#666;
    padding:12px
}

@font-face {
    font-family: 'CHULACHARAS NEW';
    /* ชี้ไปที่โฟลเดอร์ Chula-Fonts และตามด้วยชื่อไฟล์จริง */
    src: url('fonts/Chula-Fonts/ChulaCharasNewReg.ttf') format('woff2'),
         url('fonts/Chula-Fonts/ChulaCharasNewReg.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'CHULALONGKORN';
    src: url('fonts/Chula-Fonts/ChulaCharasNewReg.ttf') format('woff2'),
         url('fonts/Chula-Fonts/ChulaCharasNewReg.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

        .form-container {
            background: white;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            max-width: 500px;
            margin: 20px auto;
        }

        .form-group { 
            margin-bottom: 15px; 
        }

        .form-group label { 
            display: block; 
            margin-bottom: 5px; 
            font-weight: bold; 
        }
        
        .form-group input {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box; /* ป้องกัน input ล้นขอบ */
        }

        .form-box {
        width: 540px;
        margin: 40px auto;
        background: #ffffff;
        padding: 35px 40px;
        border-radius: 18px;
        box-shadow: 0 10px 28px rgba(0,0,0,0.12);
        border: 1px solid #e4f2e9;
        animation: fadein .45s ease;
    }
