/**
 * ============================================================
 * ไฟล์  : layout-chemiwaste.css
 * ระบบ  : ChemiWaste (ระบบย่อย PathoBio)
 * ============================================================
 * หน้าที่:
 *   Layout CSS — Amber/Orange theme (#b45309)
 *   Topbar, Sidebar, Components, Responsive
 *
 * การเปลี่ยนแปลงจากเวอร์ชันก่อน:
 *   - [2026-06-21] เพิ่ม .sb-item-link/.sb-badge-info — รองรับ badge "คำขอของฉัน" ที่เมนู
 *     คลังสารเคมีใน layout_header.php ที่ต้องเป็น <a> กดได้เองแยกจากลิงก์หลักของเมนู
 * ============================================================
 */

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== CSS Variables (Amber theme — chemical safety color) ===== */
:root {
    --primary:       #b45309;
    --primary-dark:  #92400e;
    --primary-pale:  #fffbeb;
    --accent:        #d97706;
    --gray-50:       #f9fafb;
    --gray-100:      #f3f4f6;
    --gray-200:      #e5e7eb;
    --gray-300:      #d1d5db;
    --gray-400:      #9ca3af;
    --gray-500:      #6b7280;
    --gray-600:      #4b5563;
    --gray-700:      #374151;
    --gray-800:      #1f2937;
    --sidebar-w:     248px;
    --topbar-h:      56px;
    --radius:        10px;
    --shadow:        0 2px 8px rgba(0,0,0,0.08);
    --transition:    0.2s ease;
}

/* ===== Base ===== */
html { font-size: 14px; height: 100%; }
body {
    font-family: 'Sarabun', sans-serif;
    background: #f9fafb;
    color: var(--gray-800);
    line-height: 1.6;
    overflow-x: hidden;
}
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: 'Sarabun', sans-serif; }

/* ===== TOPBAR ===== */
.topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--primary);
    display: flex; align-items: center;
    padding: 0 16px 0 0; gap: 0;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.topbar-brand {
    display: flex; align-items: center; gap: 10px;
    width: var(--sidebar-w); flex-shrink: 0;
    padding: 0 16px;
    border-right: 1px solid rgba(255,255,255,0.15);
    height: 100%;
}
.topbar-brand-icon {
    width: 34px; height: 34px; border-radius: 8px;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center; font-size: 18px;
    flex-shrink: 0;
}
.topbar-brand-name { font-size: 15px; font-weight: 700; color: #fff; }
.topbar-brand-sub  { font-size: 10px; color: rgba(255,255,255,0.6); }
.topbar-spacer { flex: 1; padding-left: 16px; }
.topbar-page-title { font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.9); }
.topbar-right { display: flex; align-items: center; gap: 4px; padding: 0 8px; }
.topbar-btn {
    padding: 5px 11px; border-radius: 6px; border: none;
    background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.85);
    font-family: 'Sarabun',sans-serif; font-size: 12px;
    cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
    transition: all 0.15s;
}
.topbar-btn:hover { background: rgba(255,255,255,0.25); color: #fff; }
.topbar-user {
    display: flex; align-items: center; gap: 8px;
    padding: 0 10px; border-left: 1px solid rgba(255,255,255,0.15);
    height: 100%;
}
.topbar-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.topbar-uname { font-size: 12px; color: #fff; font-weight: 600; }
.topbar-urole { font-size: 10px; color: rgba(255,255,255,0.6); }
.topbar-logout {
    padding: 5px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.75);
    font-family: 'Sarabun',sans-serif; font-size: 12px;
    cursor: pointer; text-decoration: none;
    transition: all 0.15s; margin-left: 4px;
}
.topbar-logout:hover { background: rgba(255,0,0,0.2); border-color: rgba(255,255,255,0.4); color: #fff; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--gray-200);
    position: fixed; top: var(--topbar-h); left: 0;
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto; z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-200) transparent;
}
.back-btn {
    display: flex; align-items: center; gap: 7px;
    padding: 10px 14px; font-size: 12px; font-weight: 600;
    color: var(--primary); text-decoration: none;
    background: var(--primary-pale);
    border-bottom: 1px solid var(--gray-200);
    transition: background 0.15s;
}
.back-btn:hover { background: #fde68a; }
.sb-section { padding: 12px 10px 2px; }
.sb-label {
    font-size: 10px; font-weight: 700; color: var(--gray-400);
    text-transform: uppercase; letter-spacing: 0.8px;
    padding: 0 8px; margin-bottom: 3px;
}
.sb-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; border-radius: 7px;
    color: var(--gray-600); font-size: 13px; font-weight: 500;
    text-decoration: none; transition: all 0.15s; margin-bottom: 1px;
    position: relative;
}
.sb-item:hover { background: var(--gray-100); color: var(--gray-800); }
.sb-item.active { background: var(--primary-pale); color: var(--primary); font-weight: 600; }
.sb-item.active .sb-icon { color: var(--primary); }
.sb-icon { width: 18px; text-align: center; font-size: 14px; color: var(--gray-400); flex-shrink: 0; }
.sb-divider { height: 1px; background: var(--gray-100); margin: 6px 12px; }
.sb-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 20px; background: #dc2626;
    color: #fff; font-size: 10px; font-weight: 800;
    margin-left: auto; flex-shrink: 0;
    text-decoration: none; /* บาง badge เป็น <a> ที่กดได้ (ดูคอมเมนต์ 2026-06-21 ด้านบน) */
}
.sb-badge-green { background: #16a34a; }
.sb-badge-warn  { background: #d97706; }
.sb-badge-info  { background: #1d4ed8; }
.sb-badge[href]:hover { opacity: .85; cursor: pointer; }
/* [2026-06-21] .sb-item-link: ลิงก์หลักภายใน .sb-item ที่ถูกเปลี่ยนเป็น <div> ครอบ
   เพื่อให้ badge คำขอของฉัน (สารเคมี) เป็น <a> แยกที่กดได้เองโดยไม่ nest <a> ใน <a> */
.sb-item-link {
    display: flex; align-items: center; gap: 8px;
    flex: 1; min-width: 0; color: inherit; text-decoration: none;
}
.sb-tag {
    font-size: 9px; font-weight: 700; padding: 1px 5px;
    border-radius: 4px; margin-left: auto;
    background: var(--primary-pale); color: var(--primary);
}

/* ===== MAIN WRAPPER ===== */
.main-wrap {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    min-height: calc(100vh - var(--topbar-h));
    display: flex; flex-direction: column;
    background: #f9fafb;
    padding-bottom: 44px;
}
.content {
    padding: 22px;
    flex: 1 0 auto;
    min-width: 0;
}

/* ===== FOOTER ===== */
.content-footer {
    position: fixed; bottom: 0;
    left: var(--sidebar-w); right: 0;
    z-index: 50; height: 44px;
    padding: 0 22px;
    border-top: 1px solid var(--gray-200);
    background: #fff;
    font-size: 11px; color: var(--gray-400);
    display: flex; justify-content: space-between;
    align-items: center; gap: 8px;
}

/* ===== SESSION WARN MODAL ===== */
.swm-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.55); z-index: 9999;
    align-items: center; justify-content: center; padding: 16px;
}
.swm-box {
    background: #fff; border-radius: 16px;
    padding: 28px 32px; width: 360px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    text-align: center; animation: popIn .25s ease;
}
.swm-icon { font-size: 36px; margin-bottom: 10px; }
.swm-title { font-size: 16px; font-weight: 700; color: #111827; margin-bottom: 6px; }
.swm-msg { font-size: 13px; color: #6b7280; margin-bottom: 18px; line-height: 1.6; }
.swm-countdown { font-size: 28px; font-weight: 800; color: #dc2626; }
.swm-actions { display: flex; gap: 10px; justify-content: center; }
.swm-btn-extend {
    padding: 10px 20px; background: var(--primary); color: #fff;
    border: none; border-radius: 8px; font-size: 14px; font-weight: 700;
    cursor: pointer; font-family: inherit;
}
.swm-btn-extend:hover { background: var(--primary-dark); }
.swm-btn-logout {
    padding: 10px 16px; background: #f3f4f6; color: #374151;
    border: 1.5px solid #e5e7eb; border-radius: 8px;
    font-size: 13px; font-weight: 600; text-decoration: none;
    display: inline-flex; align-items: center; font-family: inherit;
}

/* ===== COMPONENTS ===== */

/* Card */
.card { background: #fff; border-radius: var(--radius); border: 1px solid var(--gray-200); margin-bottom: 16px; min-width: 0; }
.card-header { padding: 12px 18px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card-title { font-size: 13px; font-weight: 700; color: var(--gray-800); }
.card-body  { padding: 18px; }

/* Page Header */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title  { font-size: 19px; font-weight: 700; color: var(--gray-800); }
.page-subtitle { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 15px; border-radius: 7px; font-family: 'Sarabun',sans-serif; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; border: none; transition: all 0.2s; }
.btn-primary   { background: var(--primary);  color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger    { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-success   { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.btn-success:hover { background: #dcfce7; }
.btn-warning   { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.btn-info      { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.btn-sm  { padding: 4px 10px; font-size: 12px; }
.btn-xs  { padding: 2px 7px; font-size: 11px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.badge-danger  { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-gray    { background: #f3f4f6; color: #4b5563; border: 1px solid #e5e7eb; }
.badge-purple  { background: #f5f3ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.badge-orange  { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

/* Alert Messages — [FIX 2026-06-20] เปลี่ยนจาก .flash → .alert ให้ตรงกับมาตรฐานกลาง
   CONVENTIONS.md §8 (ต้นแบบ Assets/Booking/Histopath) — สีเดิมเหมือนกันทุกประการ แค่เปลี่ยนชื่อ class */
.alert { padding: 11px 16px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; display: flex; align-items: flex-start; gap: 8px; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* Data Table */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 9px 14px; font-size: 11px; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.5px; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-responsive .data-table { min-width: 600px; }

/* Forms */
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-600); margin-bottom: 4px; }
.form-field input, .form-field select, .form-field textarea {
    width: 100%; padding: 8px 12px; border: 1.5px solid var(--gray-200);
    border-radius: 7px; font-family: 'Sarabun',sans-serif; font-size: 13px;
    outline: none; transition: border-color 0.2s; background: #fff;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(180,83,9,0.12);
}
.form-field textarea { resize: vertical; min-height: 72px; }

/* ── Checkbox / Radio ── undo width:100% จาก .form-field input ── */
.form-field input[type="checkbox"],
.form-field input[type="radio"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    padding: 0;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    box-shadow: none;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ── Toggle card — label ที่ครอบ checkbox ─── */
.form-field label:has(input[type="checkbox"]),
.form-field label:has(input[type="radio"]),
.toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-700);
    margin-bottom: 0;
    padding: 10px 14px;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}
.form-field label:has(input[type="checkbox"]):hover,
.form-field label:has(input[type="radio"]):hover,
.toggle-label:hover {
    background: var(--primary-pale);
    border-color: var(--accent);
}
.form-field label:has(input[type="checkbox"]:checked),
.form-field label:has(input[type="radio"]:checked),
.toggle-label:has(input:checked) {
    background: var(--primary-pale);
    border-color: var(--primary);
    color: var(--primary-dark);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-full { grid-column: 1 / -1; }
.required { color: #dc2626; }
.form-hint { font-size: 11px; color: var(--gray-400); margin-top: 3px; }
.form-section-title { font-size: 13px; font-weight: 700; color: var(--gray-700); padding: 16px 0 8px; border-top: 1px solid var(--gray-100); margin-top: 8px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 16px; border-top: 1px solid var(--gray-100); margin-top: 16px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 16px; }
.stat-card  { background: #fff; border-radius: var(--radius); border: 1px solid var(--gray-200); padding: 16px; display: flex; align-items: center; gap: 14px; }
.stat-icon  { width: 42px; height: 42px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.stat-icon.amber  { background: #fff7ed; }
.stat-icon.green  { background: #f0fdf4; }
.stat-icon.orange { background: #fff7ed; }
.stat-icon.red    { background: #fef2f2; }
.stat-icon.blue   { background: #eff6ff; }
.stat-icon.purple { background: #f5f3ff; }
.stat-icon.teal   { background: #f0fdfa; }
.stat-icon.gray   { background: #f3f4f6; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--gray-800); line-height: 1; }
.stat-label { font-size: 11px; color: var(--gray-400); margin-top: 3px; }
a.stat-card { text-decoration: none; cursor: pointer; transition: transform .15s, box-shadow .15s; }
a.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); border-color: var(--primary); }

/* Filter Bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 18px; background: var(--gray-50); border-bottom: 1px solid var(--gray-100); }
.filter-bar input, .filter-bar select { padding: 6px 10px; border: 1.5px solid var(--gray-200); border-radius: 6px; font-family: 'Sarabun',sans-serif; font-size: 12px; outline: none; }
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--primary); }

/* Pagination */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 16px 0 0; }
.page-btn { padding: 5px 10px; border-radius: 6px; border: 1.5px solid var(--gray-200); font-size: 12px; color: var(--gray-600); text-decoration: none; transition: all 0.15s; }
.page-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-pale); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.page-gap { padding: 5px 4px; font-size: 12px; color: var(--gray-400); }

/* Tabs */
.tab-bar { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 16px; }
.tab-item { padding: 9px 18px; font-size: 13px; font-weight: 600; color: var(--gray-500); border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; text-decoration: none; transition: all 0.15s; }
.tab-item:hover { color: var(--gray-800); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Utility */
.u-hidden { display: none !important; }
.w-100 { width: 100% !important; }
.text-muted { color: var(--gray-400); font-size: 12px; }
.text-danger { color: #dc2626; }
.text-success { color: #166534; }
.text-warning { color: #92400e; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* Modal */
.modal-hidden { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 500; align-items: center; justify-content: center; padding: 16px; }
[hidden][style*="display:flex"], [hidden][style*="display: flex"] { display: flex !important; }
[hidden][style*="display:block"], [hidden][style*="display: block"] { display: block !important; }
.modal-box { background: #fff; border-radius: 14px; padding: 24px; max-width: 480px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }

/* ===== LOGIN PAGE ===== */
.login-body { background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 50%, #fff 100%); }
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 36px; width: 100%; max-width: 420px; box-shadow: 0 4px 24px rgba(180,83,9,0.12); border: 1px solid #fed7aa; }
.login-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.login-logo-icon { font-size: 40px; }
.login-system-name { font-size: 24px; font-weight: 700; color: var(--primary); }
.login-system-sub  { font-size: 12px; color: var(--gray-400); margin-top: 1px; }
.login-info-box { display: flex; gap: 10px; background: var(--primary-pale); border: 1px solid #fde68a; border-radius: 8px; padding: 12px 14px; margin-bottom: 20px; }
.login-info-icon { font-size: 18px; flex-shrink: 0; }
.login-info-text { font-size: 12px; color: var(--gray-700); line-height: 1.6; }
.btn-sso { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 13px 20px; background: var(--primary); color: #fff; border-radius: 10px; font-family: 'Sarabun',sans-serif; font-size: 15px; font-weight: 700; text-decoration: none; transition: background 0.2s; margin-bottom: 20px; }
.btn-sso:hover { background: var(--primary-dark); }
.btn-sso-icon { font-size: 20px; }
.login-legend { border-top: 1px solid var(--gray-100); padding-top: 14px; margin-bottom: 16px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--gray-600); margin-bottom: 6px; }
.legend-item.legend-no { opacity: 0.5; }
.legend-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.legend-admin { background: #fef3c7; color: #92400e; }
.legend-write { background: #dcfce7; color: #166534; }
.legend-none  { background: #f3f4f6; color: #6b7280; }
.login-lang { display: flex; align-items: center; gap: 6px; justify-content: flex-end; font-size: 12px; color: var(--gray-400); }
.lang-btn { color: var(--gray-500); padding: 2px 4px; font-weight: 600; }
.lang-btn.active { color: var(--primary); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) { #sessionWarnModal { display: none !important; } }
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; z-index: 999; top: 0; height: 100vh; box-shadow: 4px 0 20px rgba(0,0,0,.15); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 998; }
    .sidebar-overlay.open { display: block; }
    .main-wrap { margin-left: 0; }
    .content-footer { left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
    .hamburger { display: flex !important; }
    .topbar-brand-sub, .topbar-uname { display: none; }
}
@media (min-width: 769px) { .hamburger { display: none !important; } }
.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; margin-right: 4px; }
.hamburger span { display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px; transition: .2s; }

@keyframes popIn { from{transform:scale(.85);opacity:0} to{transform:scale(1);opacity:1} }

/* ─── เพิ่มใน layout-chemiwaste.css (ท้ายไฟล์) ─── */

/* Active language button */
.topbar-btn-active {
    background: rgba(255,255,255,0.3) !important;
    color: #fff !important;
    font-weight: 700;
}

/* Logout button — ← ออก */
.topbar-logout {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
    font-family: 'Sarabun', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    margin-left: 8px;
    transition: all 0.15s;
    white-space: nowrap;
}
.topbar-logout:hover {
    background: rgba(220,38,38,0.3);
    border-color: rgba(255,255,255,0.5);
    color: #fff;
}

/* ─── แทนที่ section FOOTER + CONTACT MODAL ทั้งหมด ─── */

/* ════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════ */
.cw-footer {
    position: fixed; bottom: 0;
    left: var(--sidebar-w); right: 0;
    z-index: 50; min-height: 46px;
    padding: 0 22px;
    border-top: 1px solid var(--gray-200);
    background: #fff;
    display: flex;
    align-items: center;
}
.cw-footer-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
}
.cw-footer-text {
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
    flex-shrink: 0;
}
.cw-footer-text strong { color: var(--primary); }

/* ปุ่มต่อกับข้อความทันที */
.cw-footer-contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-family: 'Sarabun', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(180,83,9,0.22);
    transition: background .15s, transform .1s, box-shadow .15s;
    line-height: 1.4;
}
.cw-footer-contact-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 14px rgba(180,83,9,0.32);
    transform: translateY(-1px);
}
.cw-footer-contact-btn:active { transform: translateY(0); }

/* ════════════════════════════════════════════
   CONTACT MODAL OVERLAY
════════════════════════════════════════════ */
.cw-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Generic large modal box (admin pages) */
.cw-modal-box-lg {
    background: #fff;
    border-radius: 12px;
    width: min(700px, 96vw);
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
}

/* Generic medium modal box (admin pages) */
.cw-modal-box {
    background: #fff;
    border-radius: 12px;
    width: min(500px, 96vw);
    padding: 24px;
}

/* ════════════════════════════════════════════
   CONTACT MODAL BOX
════════════════════════════════════════════ */
.cw-contact-modal {
    background: #fff;
    border-radius: 24px;
    width: 100%;
    max-width: 360px;
    overflow: hidden;
    box-shadow:
        0 4px 6px rgba(0,0,0,.04),
        0 24px 64px rgba(0,0,0,.16);
    animation: cwPopIn .22s cubic-bezier(.34,1.56,.64,1);
}
@keyframes cwPopIn {
    from { transform: scale(.88) translateY(8px); opacity: 0; }
    to   { transform: scale(1)   translateY(0);   opacity: 1; }
}

/* Header */
.cw-cm-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 20px 14px;
    border-bottom: 1px solid #f3f4f6;
}
.cw-cm-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 16px; font-weight: 700; color: #111827;
}
.cw-cm-title-icon { font-size: 20px; }
.cw-cm-x {
    width: 28px; height: 28px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    color: #6b7280;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.cw-cm-x:hover { background: #e5e7eb; color: #111827; }

/* Body */
.cw-cm-body {
    padding: 20px 20px 4px;
    display: flex; flex-direction: column; gap: 18px;
}
.cw-cm-item {
    display: flex; align-items: center; gap: 14px;
}
.cw-cm-item-icon {
    width: 46px; height: 46px;
    border-radius: 14px;
    display: flex; align-items: center;
    justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.cw-cm-icon-phone { background: #ede9fe; }
.cw-cm-icon-email { background: #fce7f3; }

.cw-cm-item-info { display: flex; flex-direction: column; gap: 2px; }
.cw-cm-item-label {
    font-size: 11px; color: #9ca3af;
    font-weight: 500; letter-spacing: .3px;
    text-transform: uppercase;
}
.cw-cm-item-val {
    font-size: 16px; font-weight: 700;
    color: var(--primary); text-decoration: none;
    transition: color .15s;
}
.cw-cm-item-val:hover { color: var(--primary-dark); text-decoration: underline; }

/* Footer */
.cw-cm-footer { padding: 16px; }
.cw-cm-close-btn {
    width: 100%; padding: 12px;
    background: #f3f4f6; color: #374151;
    border: none; border-radius: 14px;
    font-family: 'Sarabun', sans-serif;
    font-size: 15px; font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.cw-cm-close-btn:hover { background: #e5e7eb; }

/* Mobile */
@media (max-width: 768px) {
    .cw-footer { left: 0; padding: 0 12px; }
}


/* ─── เพิ่มใน layout-chemiwaste.css (ท้ายไฟล์) ─── */

/* topbar-btn-active — ปุ่ม TH/EN ที่เลือกอยู่ */
.topbar-btn-active {
    background: rgba(255,255,255,0.30) !important;
    color: #fff !important;
    font-weight: 700;
}

/* topbar avatar รูปจริง */
.topbar-avatar-img {
    width: 30px; height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
}

/* topbar-logout ปุ่ม ← ออก */
.topbar-logout {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
    font-family: 'Sarabun', sans-serif;
    font-size: 12px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    margin-left: 6px;
    transition: all .15s;
    white-space: nowrap;
}
.topbar-logout:hover {
    background: rgba(220,38,38,0.25);
    border-color: rgba(255,255,255,0.4);
    color: #fff;
}

/* ════════════════════════════════════════════════════════════
   PRINT — ใช้ร่วมกันทุกหน้า: ซ่อน topbar/sidebar/footer/ปุ่ม
   และแสดงหัวข้อรายงาน (.print-report-title) แทน
   ════════════════════════════════════════════════════════════ */
.print-report-title { display: none; }
@media print {
    body, html { margin: 0; padding: 0; }
    .topbar, .sidebar, .sidebar-overlay, .cw-footer,
    .page-header, .scroll-to-top, .btn, button { display: none !important; }
    .content { margin: 0 !important; padding: 0 !important; width: 100% !important; }
    .print-report-title {
        display: block !important;
        font-size: 15pt; font-weight: 800; color: #1e3a8a;
        text-align: center;
        border-bottom: 2px solid #1e3a8a;
        padding-bottom: 6px; margin-bottom: 14px;
    }
}
