/* ==========================================================================
   Teletubbies Library — Unified Theme v4 (tt-theme.css)
   ธีมกลางของ "ทุกหน้า" ในระบบ (หลังบ้าน / OPAC / Login / หน้าสมาชิก)
   - สีทั้งหมดอ่านจากหน้า "ตั้งค่าระบบ > สีสัน" ผ่านตัวแปร
       --system-theme-primary / --system-theme-secondary / --system-theme-background
     (ถ้าไม่มี จะใช้ --theme-primary ฯลฯ จาก layout_header.php และค่าเริ่มต้นด้านล่าง)
   - เปลี่ยนสีในหน้าตั้งค่า → ทุกส่วนเปลี่ยนตามทันที (เรียลไทม์) โดยไม่ต้องรีเฟรช
   - ไม่แก้โครงสร้าง HTML/PHP เดิม ใช้การ override ด้วย CSS เท่านั้น
   ========================================================================== */

:root {
    /* ---------- สีหลักจากการตั้งค่า ---------- */
    --tt-p: var(--system-theme-primary, var(--theme-primary, #7c3aed));
    --tt-s: var(--system-theme-secondary, var(--theme-secondary, #4c1d95));
    --tt-bgc: var(--system-theme-background, var(--theme-background, #f5f3ff));

    /* ---------- เฉดที่คำนวณจากสีหลัก ---------- */
    --tt-primary: var(--tt-p);
    --tt-primary-50: color-mix(in srgb, var(--tt-p) 6%, #fff);
    --tt-primary-100: color-mix(in srgb, var(--tt-p) 13%, #fff);
    --tt-primary-200: color-mix(in srgb, var(--tt-p) 24%, #fff);
    --tt-primary-300: color-mix(in srgb, var(--tt-p) 48%, #fff);
    --tt-primary-400: color-mix(in srgb, var(--tt-p) 78%, #fff);
    --tt-primary-600: color-mix(in srgb, var(--tt-p) 78%, var(--tt-s));
    --tt-primary-700: color-mix(in srgb, var(--tt-p) 45%, var(--tt-s));
    --tt-primary-800: color-mix(in srgb, var(--tt-s) 80%, #000);
    --tt-grad: linear-gradient(135deg, color-mix(in srgb, var(--tt-p) 88%, #fff) 0%, var(--tt-p) 45%, color-mix(in srgb, var(--tt-p) 55%, var(--tt-s)) 100%);
    --tt-grad-v: linear-gradient(180deg, color-mix(in srgb, var(--tt-p) 82%, #fff) 0%, color-mix(in srgb, var(--tt-p) 80%, var(--tt-s)) 100%);

    /* ---------- พื้นผิว / ตัวอักษร ---------- */
    /* พื้นหลังเข้มขึ้นเล็กน้อย (ไม่แสบตา) เพื่อให้การ์ดสีขาวลอยเด่น */
    --tt-bg: color-mix(in srgb, var(--tt-bgc) 40%, color-mix(in srgb, var(--tt-p) 9%, #e7e9f1));
    --tt-bg-2: color-mix(in srgb, var(--tt-bgc) 30%, color-mix(in srgb, var(--tt-p) 12%, #dfe2ec));
    --tt-surface: #ffffff;
    --tt-surface-2: color-mix(in srgb, var(--tt-p) 3%, #fbfcfe);
    --tt-ink: color-mix(in srgb, var(--tt-s) 18%, #0f1324);
    --tt-ink-2: color-mix(in srgb, var(--tt-s) 14%, #2c3247);
    --tt-muted: color-mix(in srgb, var(--tt-s) 10%, #555c72);
    --tt-line: color-mix(in srgb, var(--tt-p) 10%, #dfe2ea);
    --tt-line-2: color-mix(in srgb, var(--tt-p) 18%, #cfd4df);
    --tt-heading: color-mix(in srgb, var(--tt-s) 50%, #10132a);
    /* หัวหน้าแบบเข้ม (ใช้กับหน้าที่ออกแบบมาเป็นตัวอักษรสีขาว) */
    --tt-hero: linear-gradient(120deg, color-mix(in srgb, color-mix(in srgb, var(--tt-p) 45%, var(--tt-s)) 85%, #000) 0%, color-mix(in srgb, var(--tt-p) 70%, var(--tt-s)) 55%, var(--tt-p) 100%);

    /* ---------- สีสถานะ (คงที่ ไม่เปลี่ยนตามธีม) ---------- */
    --tt-blue: #3b82f6;   --tt-blue-soft: #e8f1ff;
    --tt-green: #16a34a;  --tt-green-soft: #e4f7ea;
    --tt-red: #e11d48;    --tt-red-soft: #ffe8ec;
    --tt-yellow: #eab308; --tt-yellow-soft: #fdf6d8;
    --tt-purple: #8b5cf6; --tt-purple-soft: #f1ebff;
    --tt-pink: #ec4899;   --tt-pink-soft: #fde8f3;
    --tt-orange: #f97316; --tt-orange-soft: #ffeedd;

    /* ---------- รูปทรง / เงา ---------- */
    --tt-radius: 16px;
    --tt-radius-lg: 22px;
    --tt-radius-xl: 28px;
    /* เงาการ์ดแบบมีมิติ: ขอบบนสว่าง + เงาซ้อน 2 ชั้น */
    --tt-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 1px 2px rgba(16, 24, 40, .08), 0 4px 10px -2px rgba(16, 24, 40, .06), 0 18px 36px -18px color-mix(in srgb, var(--tt-s) 45%, transparent);
    --tt-shadow-lg: inset 0 1px 0 rgba(255, 255, 255, .9), 0 2px 6px rgba(16, 24, 40, .08), 0 28px 54px -20px color-mix(in srgb, var(--tt-s) 55%, transparent);
    --tt-ring: 0 0 0 4px color-mix(in srgb, var(--tt-p) 18%, transparent);
    --tt-raise: 0 4px 0 var(--tt-primary-700), 0 10px 20px -6px color-mix(in srgb, var(--tt-p) 55%, transparent);
    --tt-raise-hover: 0 5px 0 var(--tt-primary-700), 0 14px 26px -8px color-mix(in srgb, var(--tt-p) 60%, transparent);
    --tt-inset: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -2px 4px rgba(0, 0, 0, .08);

    --tt-font: 'Prompt', 'Sarabun', Tahoma, sans-serif;
    --tt-font-body: 'Sarabun', 'Prompt', Tahoma, sans-serif;
    --tt-font-display: 'Mitr', 'Prompt', Tahoma, sans-serif;

    /* ---------- ทับตัวแปรเดิมของหน้าเก่าทั้งหมด ให้ไปทางเดียวกัน ---------- */
    --o-50: var(--tt-primary-50);
    --o-100: var(--tt-primary-100);
    --o-200: var(--tt-primary-200);
    --o-300: var(--tt-primary-300);
    --o-400: var(--tt-primary-400);
    --o-500: var(--tt-p);
    --o-600: var(--tt-primary-600);
    --o-700: var(--tt-primary-700);
    --warm-ink: var(--tt-ink);
    --warm-ink-soft: var(--tt-muted);
    --glass: rgba(255, 255, 255, .86);
    --glass-border: rgba(255, 255, 255, .9);
    --shadow-soft: var(--tt-shadow);
    --shadow-btn: var(--tt-raise);
    --inset-hi: var(--tt-inset);

    /* ตัวแปรของบล็อก UI-POLISH ใน layout_header.php → ให้เป็นโทนของระบบ */
    --ui-ink: var(--tt-ink);
    --ui-line: var(--tt-line-2);
    --ui-field: #ffffff;
    --ui-field-dis: #f3f4f8;
    --ui-ring: color-mix(in srgb, var(--tt-p) 18%, transparent);
    --ui-raise: var(--tt-shadow);
    --ui-raise-sm: 0 6px 14px -8px color-mix(in srgb, var(--tt-s) 35%, transparent);
    --ui-sink: inset 0 1px 2px rgba(16, 24, 40, .05);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
html, body {
    font-family: var(--tt-font-body) !important;
    color: var(--tt-ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
html body.tt-admin,
html body:has(.app-layout-wrapper) {
    background:
        radial-gradient(1200px 620px at 105% -10%, color-mix(in srgb, var(--tt-p) 10%, transparent), transparent 62%),
        radial-gradient(900px 520px at -10% 110%, color-mix(in srgb, var(--tt-s) 7%, transparent), transparent 60%),
        var(--tt-bg) !important;
    background-attachment: fixed !important;
}
h1, h2, h3, h4, h5, h6, .tt-font,
.btn, button, .sidebar-item, label, th {
    font-family: var(--tt-font);
}
::selection { background: color-mix(in srgb, var(--tt-p) 26%, #fff); color: var(--tt-ink); }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--tt-p) 30%, #d8dbe4) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--tt-p) 28%, #d8dbe4); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* --------------------------------------------------------------------------
   Sidebar — ค่าเริ่มต้น: แถบสว่าง / เมื่อเปิด "แถบเมนูด้านข้างสีเข้ม": ไล่สีจากสีหลัก
   -------------------------------------------------------------------------- */
html body .app-layout-wrapper { background: transparent !important; }
/* ให้แถบเมนูด้านข้างติดหน้าจอได้จริง (overflow-x:hidden เดิมทำให้ sticky ไม่ทำงาน) */
html:has(.app-layout-wrapper), html body:has(.app-layout-wrapper) { overflow-x: clip !important; }
html body .app-layout-wrapper .sidebar-left {
    width: 268px !important;
    background: rgba(255, 255, 255, .92) !important;
    background-image: none !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-right: 1px solid var(--tt-line) !important;
    box-shadow: 6px 0 30px -18px color-mix(in srgb, var(--tt-s) 40%, transparent) !important;
    padding: 18px 14px 22px !important;
    position: sticky;
    top: 0;
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    scrollbar-width: none;
    z-index: 1010;
}
html body .app-layout-wrapper .sidebar-left::-webkit-scrollbar { display: none; }
html body .sidebar-left > .text-center {
    position: relative;
    margin: 2px 4px 18px !important;
    padding: 18px 10px 16px;
    border-radius: 22px;
    background:
        radial-gradient(120px 80px at 20% 0%, rgba(255, 255, 255, .55), transparent 70%),
        var(--tt-grad);
    box-shadow: 0 14px 28px -14px color-mix(in srgb, var(--tt-p) 70%, transparent);
    overflow: hidden;
}
html body .sidebar-left > .text-center::before,
html body .sidebar-left > .text-center::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    pointer-events: none;
}
html body .sidebar-left > .text-center::before { width: 120px; height: 120px; right: -40px; top: -50px; }
html body .sidebar-left > .text-center::after { width: 80px; height: 80px; left: -30px; bottom: -36px; }
html body .sidebar-left .sidebar-logo {
    position: relative;
    z-index: 1;
    width: 112px !important;
    height: 112px !important;
    max-width: 112px !important;
    object-fit: cover !important;
    border: 4px solid #fff !important;
    border-radius: 50% !important;
    box-shadow: 0 10px 24px -6px rgba(0, 0, 0, .35) !important;
    background: #fff;
}
html body .sidebar-left nav.nav { gap: 2px; }
html body .sidebar-left .sidebar-item {
    position: relative;
    display: flex !important;
    align-items: center;
    gap: 12px;
    color: var(--tt-ink-2) !important;
    font-family: var(--tt-font) !important;
    font-weight: 500 !important;
    font-size: 14.5px !important;
    line-height: 1.25;
    padding: 8px 12px 8px 8px !important;
    margin: 0 0 3px !important;
    border-radius: 14px !important;
    text-shadow: none !important;
    background: transparent !important;
    box-shadow: none !important;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
html body .sidebar-left .sidebar-item i {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    font-size: 16.5px;
    color: var(--tt-primary-600) !important;
    background: var(--tt-primary-50);
    transition: background .18s ease, color .18s ease;
}
html body .sidebar-left .sidebar-item:hover {
    background: var(--tt-primary-50) !important;
    color: var(--tt-primary-700) !important;
    transform: translateX(2px);
}
html body .sidebar-left .sidebar-item:hover i { background: var(--tt-primary-100); }
html body .sidebar-left .sidebar-item.active {
    background: var(--tt-grad-v) !important;
    color: #fff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 0 var(--tt-primary-700), 0 12px 22px -10px color-mix(in srgb, var(--tt-p) 75%, transparent), inset 0 1px 0 rgba(255, 255, 255, .3) !important;
}
html body .sidebar-left .sidebar-item.active i { background: rgba(255, 255, 255, .22); color: #fff !important; }

/* ---- แถบเมนูสีเข้ม ---- */
html body .app-layout-wrapper .sidebar-left.dark-sidebar {
    background: linear-gradient(175deg, color-mix(in srgb, var(--tt-p) 92%, #fff) 0%, var(--tt-p) 38%, color-mix(in srgb, var(--tt-p) 40%, var(--tt-s)) 100%) !important;
    border-right: 0 !important;
    box-shadow: 8px 0 30px -14px color-mix(in srgb, var(--tt-s) 60%, transparent) !important;
}
html body .sidebar-left.dark-sidebar > .text-center {
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
    box-shadow: none;
}
html body .sidebar-left.dark-sidebar .sidebar-item { color: rgba(255, 255, 255, .92) !important; }
html body .sidebar-left.dark-sidebar .sidebar-item i { background: rgba(255, 255, 255, .14); color: #fff !important; }
html body .sidebar-left.dark-sidebar .sidebar-item:hover { background: rgba(255, 255, 255, .14) !important; color: #fff !important; }
html body .sidebar-left.dark-sidebar .sidebar-item:hover i { background: rgba(255, 255, 255, .22); }
html body .sidebar-left.dark-sidebar .sidebar-item.active {
    background: #fff !important;
    color: var(--tt-primary-700) !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, .14), 0 12px 22px -10px rgba(0, 0, 0, .35) !important;
}
html body .sidebar-left.dark-sidebar .sidebar-item.active i { background: var(--tt-primary-100); color: var(--tt-primary-600) !important; }

/* ปุ่มยุบเมนู */
html body #sidebarToggleBtn {
    width: 34px !important;
    height: 34px !important;
    margin: 0 0 10px auto !important;
    border: 1px solid var(--tt-line-2) !important;
    background: #fff !important;
    color: var(--tt-primary-600) !important;
    box-shadow: 0 2px 0 var(--tt-line-2), 0 6px 14px -6px color-mix(in srgb, var(--tt-s) 35%, transparent) !important;
}
html body #sidebarToggleBtn i { color: var(--tt-primary-600) !important; font-size: 16px !important; -webkit-text-stroke: .6px currentColor !important; }
html body .sidebar-left.dark-sidebar #sidebarToggleBtn { border-color: rgba(255, 255, 255, .5) !important; }

/* ยุบเมนู (เดสก์ท็อป) */
@media screen and (min-width: 993px) {
    html body .app-layout-wrapper.sidebar-collapsed .sidebar-left {
        width: 84px !important;
        min-width: 84px !important;
        max-width: 84px !important;
        flex: 0 0 84px !important;
        padding: 16px 12px !important;
    }
    html body .app-layout-wrapper.sidebar-collapsed .sidebar-item {
        justify-content: center !important;
        padding: 7px !important;
        font-size: 0 !important;
    }
    html body .app-layout-wrapper.sidebar-collapsed .sidebar-item i {
        flex-basis: 40px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
    }
    html body .app-layout-wrapper.sidebar-collapsed .main-content-full {
        width: calc(100% - 84px) !important;
        max-width: calc(100% - 84px) !important;
    }
    html body .app-layout-wrapper.sidebar-collapsed .sidebar-item:hover::after {
        border: 1px solid var(--tt-line) !important;
        background: #fff !important;
        color: var(--tt-ink) !important;
        font-family: var(--tt-font) !important;
        font-weight: 500 !important;
        font-size: 13.5px !important;
        box-shadow: var(--tt-shadow-lg) !important;
        border-radius: 12px !important;
    }
    html body .app-layout-wrapper:not(.sidebar-collapsed) .main-content-full {
        width: calc(100% - 268px) !important;
        max-width: calc(100% - 268px) !important;
    }
}

/* --------------------------------------------------------------------------
   Main content + Topbar (เต็มความกว้างหน้าจอ)
   -------------------------------------------------------------------------- */
html body .main-content-full {
    padding: 0 clamp(16px, 2vw, 32px) 32px !important;
    background: transparent !important;
}
html body .main-content-full > .global-topbar {
    margin: 0 calc(-1 * clamp(16px, 2vw, 32px)) 24px !important;
    width: auto !important;
    min-height: 72px !important;
    padding: 10px clamp(16px, 2vw, 32px) !important;
    background: rgba(255, 255, 255, .82) !important;
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--tt-line) !important;
    box-shadow: 0 10px 30px -22px color-mix(in srgb, var(--tt-s) 45%, transparent) !important;
    flex-wrap: nowrap !important;
}
.tt-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    margin-right: 4px;
    border: 1px solid var(--tt-line);
    border-radius: 13px;
    background: #fff;
    color: var(--tt-ink-2);
    font-size: 22px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.tt-burger:hover { background: var(--tt-primary-50); color: var(--tt-primary-700); }
html body .global-brand { gap: 10px !important; }
html body .global-brand-text strong {
    font-family: var(--tt-font) !important;
    color: var(--tt-heading) !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    text-shadow: none !important;
    letter-spacing: -.01em;
}
html body .global-brand-text small {
    color: var(--tt-muted) !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
}
html body .global-topbar-actions { gap: 10px !important; }
html body .global-topbar-home,
html body .global-topbar-logout,
html body .global-user-menu > summary {
    height: 44px !important;
    min-width: 0 !important;
    font-family: var(--tt-font) !important;
}
html body .global-topbar-home {
    padding: 0 18px 0 6px !important;
    gap: 10px !important;
    font-size: 14.5px !important;
    font-weight: 600 !important;
    color: var(--tt-primary-700) !important;
    text-shadow: none !important;
    border: 1px solid var(--tt-primary-200) !important;
    background: var(--tt-primary-50) !important;
    box-shadow: none !important;
}
html body .global-topbar-home i {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-size: 15px !important;
    background: var(--tt-grad-v);
    box-shadow: 0 3px 0 var(--tt-primary-700);
}
html body .global-user-menu > summary {
    padding: 0 14px 0 5px !important;
    gap: 9px !important;
    border: 1px solid var(--tt-line-2) !important;
    background: #fff !important;
    box-shadow: 0 2px 0 var(--tt-line), 0 8px 16px -10px color-mix(in srgb, var(--tt-s) 30%, transparent) !important;
}
html body .global-user-avatar {
    flex-basis: 34px !important;
    width: 34px !important;
    height: 34px !important;
    font-size: 17px !important;
    background: var(--tt-grad-v) !important;
    box-shadow: none !important;
}
html body .global-user-copy strong { font-size: 14px !important; font-weight: 600 !important; color: var(--tt-ink) !important; }
html body .global-user-copy small { font-size: 11.5px !important; color: var(--tt-muted) !important; }
html body .global-user-chevron { color: var(--tt-muted) !important; }
html body .global-user-dropdown {
    border-radius: 18px !important;
    border: 1px solid var(--tt-line) !important;
    background: #fff !important;
    box-shadow: var(--tt-shadow-lg) !important;
}
html body .global-user-dropdown .user-info-row i { color: var(--tt-primary-600) !important; }
html body .global-user-dropdown .user-info-row + .user-info-row { border-top-color: var(--tt-line) !important; }
html body .global-topbar-logout {
    padding: 0 18px 0 15px !important;
    gap: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-shadow: none !important;
    color: #e11d48 !important;
    border: 1px solid #fecdd6 !important;
    background: #fff1f3 !important;
    box-shadow: 0 2px 0 #fecdd6 !important;
}
html body .global-topbar-logout:hover {
    color: #fff !important;
    background: linear-gradient(180deg, #fb7185, #e11d48) !important;
    border-color: #e11d48 !important;
    box-shadow: 0 3px 0 #be123c, 0 10px 18px -8px rgba(225, 29, 72, .55) !important;
}
html body .global-topbar-logout i { font-size: 17px !important; }

/* กระดิ่งแจ้งเตือนเรียลไทม์ */
.tt-bell { position: relative; }
.tt-bell > summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--tt-line-2);
    color: var(--tt-primary-600);
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 0 var(--tt-line), 0 8px 16px -10px color-mix(in srgb, var(--tt-s) 30%, transparent);
}
.tt-bell > summary::-webkit-details-marker { display: none; }
.tt-bell-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 99px;
    background: #e11d48;
    color: #fff;
    font: 600 11px/20px var(--tt-font);
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}
.tt-bell-dot[hidden] { display: none; }
.tt-bell-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    z-index: 1100;
    width: 300px;
    padding: 10px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid var(--tt-line);
    box-shadow: var(--tt-shadow-lg);
}
.tt-bell-panel a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 13px;
    color: var(--tt-ink);
    text-decoration: none;
    font-family: var(--tt-font);
    font-size: 14px;
}
.tt-bell-panel a:hover { background: var(--tt-primary-50); }
.tt-bell-panel a b { margin-left: auto; font-weight: 600; }
.tt-bell-panel .tt-ico { width: 34px; height: 34px; font-size: 16px; border-radius: 10px; }
.tt-bell-head { padding: 4px 10px 8px; font: 600 14px var(--tt-font); color: var(--tt-ink-2); display: flex; justify-content: space-between; align-items: center; }
.tt-bell-head small { font-weight: 400; color: var(--tt-muted); font-size: 11px; }

/* --------------------------------------------------------------------------
   Page head (หัวหน้าแต่ละเมนู)
   -------------------------------------------------------------------------- */
.tt-page-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 18px 22px;
    border-radius: var(--tt-radius-xl);
    background:
        radial-gradient(520px 160px at 100% 0%, color-mix(in srgb, var(--tt-p) 12%, transparent), transparent 70%),
        #fff;
    border: 1px solid var(--tt-line);
    box-shadow: var(--tt-shadow);
    overflow: hidden;
}
.tt-page-head .tt-ph-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.tt-page-head .tt-ph-icon {
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    border-radius: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 23px;
    background: var(--tt-grad);
    box-shadow: 0 4px 0 var(--tt-primary-700), 0 12px 22px -10px color-mix(in srgb, var(--tt-p) 70%, transparent), var(--tt-inset);
}
.tt-page-head h1 {
    margin: 0;
    font: 700 23px/1.25 var(--tt-font);
    color: var(--tt-heading);
    letter-spacing: -.01em;
}
.tt-page-head p { margin: 3px 0 0; color: var(--tt-muted); font-size: 14.5px; }
.tt-page-head .tt-ph-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.tt-card {
    background: linear-gradient(180deg, #fff 0%, #fff 70%, var(--tt-surface-2) 100%);
    border: 1px solid var(--tt-line);
    border-radius: var(--tt-radius-lg);
    box-shadow: var(--tt-shadow);
    padding: 20px 22px;
    min-width: 0;
}
.tt-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}
.tt-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font: 600 17.5px/1.3 var(--tt-font);
    color: var(--tt-heading);
}
.tt-card-title i { color: var(--tt-primary-600); font-size: 19px; }
.tt-muted { color: var(--tt-muted); }

/* ไอคอนพื้นพาสเทล */
.tt-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    border-radius: 16px;
    font-size: 22px;
}
.tt-ico.pink   { background: var(--tt-pink-soft); color: #db2777; }
.tt-ico.blue   { background: var(--tt-blue-soft); color: #2563eb; }
.tt-ico.yellow { background: var(--tt-yellow-soft); color: #ca8a04; }
.tt-ico.purple { background: var(--tt-purple-soft); color: #7c3aed; }
.tt-ico.green  { background: var(--tt-green-soft); color: #16a34a; }
.tt-ico.orange { background: var(--tt-primary-100); color: var(--tt-primary-600); }
.tt-ico.red    { background: var(--tt-red-soft); color: #e11d48; }

/* Stat cards */
.tt-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.tt-stat {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    min-height: 148px;
    padding: 20px 22px;
    border-radius: var(--tt-radius-lg);
    text-align: left;
    text-decoration: none !important;
    color: var(--tt-ink) !important;
    background: #fff;
    border: 1px solid var(--tt-line);
    box-shadow: var(--tt-shadow);
    transition: transform .18s ease, box-shadow .18s ease;
    overflow: hidden;
    isolation: isolate;
}
.tt-stat::after {
    content: '';
    position: absolute;
    right: -38px;
    top: -38px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: currentColor;
    opacity: .07;
    z-index: -1;
}
.tt-stat:hover { transform: translateY(-3px); box-shadow: var(--tt-shadow-lg); }
.tt-stat .tt-ico { width: 52px; height: 52px; border-radius: 16px; font-size: 23px; margin-bottom: 4px; }
.tt-stat .tt-stat-label { font: 500 14.5px/1.3 var(--tt-font); color: var(--tt-ink-2); }
.tt-stat .tt-stat-value { font: 700 28px/1.1 var(--tt-font); color: var(--tt-heading); letter-spacing: -.02em; }
.tt-stat .tt-stat-value small { font-size: 15px; font-weight: 500; margin-left: 4px; color: var(--tt-muted); }
.tt-stat .tt-stat-sub { font-size: 12.5px; color: var(--tt-muted); }
.tt-stat.pink   .tt-ico { background: var(--tt-pink-soft); color: #db2777; }
.tt-stat.blue   .tt-ico { background: var(--tt-blue-soft); color: #2563eb; }
.tt-stat.yellow .tt-ico { background: var(--tt-yellow-soft); color: #ca8a04; }
.tt-stat.purple .tt-ico { background: var(--tt-purple-soft); color: #7c3aed; }
.tt-stat.green  .tt-ico { background: var(--tt-green-soft); color: #16a34a; }
.tt-stat.orange .tt-ico { background: var(--tt-primary-100); color: var(--tt-primary-600); }
.tt-stat.pink::after   { color: #db2777; }
.tt-stat.blue::after   { color: #2563eb; }
.tt-stat.yellow::after { color: #ca8a04; }
.tt-stat.purple::after { color: #7c3aed; }
.tt-stat.green::after  { color: #16a34a; }
.tt-stat.orange::after { color: var(--tt-p); }
.tt-stat.is-updated .tt-stat-value { animation: ttPulse .9s ease; }
@keyframes ttPulse { 0% { transform: scale(1); } 35% { transform: scale(1.1); color: var(--tt-primary-600); } 100% { transform: scale(1); } }

/* --------------------------------------------------------------------------
   Buttons — ปุ่มนูน (ทรงแคปซูล)
   -------------------------------------------------------------------------- */
.tt-btn {
    --b1: color-mix(in srgb, var(--tt-p) 82%, #fff);
    --b2: color-mix(in srgb, var(--tt-p) 82%, var(--tt-s));
    --bl: var(--tt-primary-700);
    --bs: color-mix(in srgb, var(--tt-p) 45%, transparent);
    --bc: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--b1) 0%, var(--b2) 100%);
    color: var(--bc) !important;
    font: 600 14.5px/1 var(--tt-font);
    text-decoration: none !important;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--bl), 0 10px 18px -8px var(--bs), var(--tt-inset);
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
    -webkit-tap-highlight-color: transparent;
}
.tt-btn:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 5px 0 var(--bl), 0 14px 24px -8px var(--bs), var(--tt-inset); }
.tt-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--bl), 0 4px 8px -4px var(--bs), inset 0 2px 4px rgba(0, 0, 0, .12); }
.tt-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--tt-p) 45%, transparent); outline-offset: 3px; }
.tt-btn i { font-size: 1.1em; }
.tt-btn.sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.tt-btn.lg { min-height: 52px; padding: 0 28px; font-size: 16px; }
.tt-btn.block { width: 100%; }
.tt-btn.green  { --b1: #4ade80; --b2: #16a34a; --bl: #15803d; --bs: rgba(22, 163, 74, .45); }
.tt-btn.blue   { --b1: #60a5fa; --b2: #2563eb; --bl: #1d4ed8; --bs: rgba(37, 99, 235, .45); }
.tt-btn.red    { --b1: #fb7185; --b2: #e11d48; --bl: #be123c; --bs: rgba(225, 29, 72, .45); }
.tt-btn.purple { --b1: #a78bfa; --b2: #7c3aed; --bl: #6d28d9; --bs: rgba(124, 58, 237, .45); }
.tt-btn.yellow { --b1: #fde047; --b2: #facc15; --bl: #ca8a04; --bs: rgba(202, 138, 4, .4); --bc: #422006; }
.tt-btn.light  { --b1: #ffffff; --b2: var(--tt-surface-2); --bl: var(--tt-line-2); --bs: color-mix(in srgb, var(--tt-s) 18%, transparent); --bc: var(--tt-ink-2); border: 1px solid var(--tt-line-2); }
.tt-btn.ghost  { background: transparent; box-shadow: none; color: var(--tt-primary-700) !important; border: 1.5px solid var(--tt-primary-300); }
.tt-btn.ghost:hover { background: var(--tt-primary-50); }
.tt-btn[disabled], .tt-btn.disabled { filter: grayscale(.6); opacity: .6; pointer-events: none; }

/* ปุ่มไอคอนสี่เหลี่ยม (ดู / แก้ไข / ลบ) */
.tt-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 16px;
    text-decoration: none !important;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
    box-shadow: 0 2px 0 rgba(0, 0, 0, .06);
}
.tt-icon-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 14px -6px rgba(0, 0, 0, .18); }
.tt-icon-btn:active { transform: translateY(1px); }
.tt-icon-btn.view   { background: var(--tt-primary-50); color: var(--tt-primary-600) !important; border-color: var(--tt-primary-200); }
.tt-icon-btn.edit   { background: #eaf2ff; color: #2563eb !important; border-color: #c7dbfe; }
.tt-icon-btn.delete { background: #ffeef1; color: #e11d48 !important; border-color: #fecdd6; }
.tt-icon-btn.green  { background: #e7f8ee; color: #16a34a !important; border-color: #bfe9cf; }

/* Pills / สถานะ */
.tt-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 13px;
    border-radius: 999px;
    font: 500 12.5px/1.3 var(--tt-font);
    white-space: nowrap;
    border: 1px solid transparent;
}
.tt-pill.green  { background: #e7f8ee; color: #15803d; border-color: #c2ebd2; }
.tt-pill.yellow { background: #fdf6d8; color: #a16207; border-color: #f6e39b; }
.tt-pill.red    { background: #ffeef1; color: #be123c; border-color: #fecdd6; }
.tt-pill.purple { background: #f3edff; color: #6d28d9; border-color: #ddd0fd; }
.tt-pill.blue   { background: #eaf2ff; color: #1d4ed8; border-color: #c7dbfe; }
.tt-pill.orange { background: var(--tt-primary-50); color: var(--tt-primary-700); border-color: var(--tt-primary-200); }
.tt-pill.gray   { background: #f2f4f8; color: #5b6275; border-color: #e2e6ee; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.tt-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tt-field > label, .tt-label { font: 500 13.5px var(--tt-font); color: var(--tt-ink-2); margin: 0; }
.tt-field > label .req { color: #e11d48; }
.tt-input, .tt-select, .tt-textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 16px;
    border: 1.5px solid var(--tt-line-2);
    border-radius: 14px;
    background: #fff;
    color: var(--tt-ink);
    font: 400 15px var(--tt-font-body);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    box-shadow: inset 0 1px 2px rgba(16, 24, 40, .04);
}
.tt-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23737a90' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
.tt-input:focus, .tt-select:focus, .tt-textarea:focus {
    border-color: var(--tt-p);
    box-shadow: var(--tt-ring);
    background-color: #fff;
}
.tt-input::placeholder, .tt-textarea::placeholder { color: #a3a9ba; }
.tt-search { position: relative; flex: 1 1 260px; min-width: 0; }
.tt-field > .tt-search { flex: 0 0 auto; width: 100%; }
.tt-search > .tt-input { display: block; }
.tt-search > i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--tt-primary-600); font-size: 16px; pointer-events: none; }
.tt-search > .tt-input { padding-left: 44px; border-radius: 999px; }
.tt-toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.tt-toolbar .tt-field { flex: 0 1 200px; }

/* ช่องกรอก/ปุ่ม Bootstrap ของหน้าเก่า (เฉพาะเนื้อหาหลังบ้าน) */
html body .main-content-full .form-control,
html body .main-content-full .form-select {
    min-height: 44px;
    border: 1.5px solid var(--tt-line-2) !important;
    border-radius: 14px !important;
    background-color: #fff !important;
    color: var(--tt-ink) !important;
    box-shadow: inset 0 1px 2px rgba(16, 24, 40, .04) !important;
}
html body .main-content-full .form-control:focus,
html body .main-content-full .form-select:focus {
    border-color: var(--tt-p) !important;
    box-shadow: var(--tt-ring) !important;
}
html body .main-content-full ::placeholder { color: #a3a9ba !important; opacity: 1; }
html body .main-content-full .form-label { font-family: var(--tt-font); font-weight: 500; color: var(--tt-ink-2); }
html body .main-content-full .form-check-input:checked { background-color: var(--tt-p) !important; border-color: var(--tt-p) !important; }

html body .main-content-full .btn {
    border-radius: 999px !important;
    font-family: var(--tt-font) !important;
    font-weight: 500 !important;
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
html body .main-content-full .btn:not(.btn-link):not(.btn-close):hover { transform: translateY(-1px); }
html body .main-content-full .btn:not(.btn-link):not(.btn-close):active { transform: translateY(2px); }
html body .main-content-full .btn-primary,
html body .main-content-full .btn-warning,
html body .main-content-full .btn-info {
    background: var(--tt-grad-v) !important;
    border: 0 !important;
    color: #fff !important;
    box-shadow: 0 3px 0 var(--tt-primary-700), 0 10px 18px -10px color-mix(in srgb, var(--tt-p) 60%, transparent), var(--tt-inset) !important;
}
html body .main-content-full .btn-success {
    background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%) !important;
    border: 0 !important;
    color: #fff !important;
    box-shadow: 0 3px 0 #15803d, 0 10px 18px -10px rgba(22, 163, 74, .55), var(--tt-inset) !important;
}
html body .main-content-full .btn-danger {
    background: linear-gradient(180deg, #fb7185 0%, #e11d48 100%) !important;
    border: 0 !important;
    color: #fff !important;
    box-shadow: 0 3px 0 #be123c, 0 10px 18px -10px rgba(225, 29, 72, .55), var(--tt-inset) !important;
}
html body .main-content-full .btn-secondary,
html body .main-content-full .btn-light,
html body .main-content-full .btn-outline-secondary,
html body .main-content-full .btn-outline-primary {
    background: #fff !important;
    border: 1.5px solid var(--tt-line-2) !important;
    color: var(--tt-ink-2) !important;
    box-shadow: 0 2px 0 var(--tt-line-2) !important;
}
html body .main-content-full .btn-outline-danger {
    background: #fff !important;
    border: 1.5px solid #fecdd6 !important;
    color: #e11d48 !important;
}

/* --------------------------------------------------------------------------
   Tables — หัวตารางสีหลักของระบบ
   -------------------------------------------------------------------------- */
.tt-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 18px;
}
html body .main-content-full table:not(.tt-plain):not(.ui-datepicker-calendar) > thead > tr > th,
.tt-table > thead > tr > th {
    background: var(--tt-grad-v) !important;
    color: #fff !important;
    font-family: var(--tt-font) !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    padding: 13px 14px !important;
    border: 0 !important;
    white-space: nowrap;
    text-shadow: none;
    vertical-align: middle;
}
html body .main-content-full table:not(.tt-plain) > thead > tr > th:first-child,
.tt-table > thead > tr > th:first-child { border-radius: 14px 0 0 14px !important; }
html body .main-content-full table:not(.tt-plain) > thead > tr > th:last-child,
.tt-table > thead > tr > th:last-child { border-radius: 0 14px 14px 0 !important; }
html body .main-content-full table:not(.tt-plain) > tbody > tr > td,
.tt-table > tbody > tr > td {
    background: #fff;
    color: var(--tt-ink);
    border-bottom: 1px solid var(--tt-line) !important;
    vertical-align: middle;
}
html body .main-content-full table:not(.tt-plain) > tbody > tr:hover > td,
.tt-table > tbody > tr:hover > td { background: var(--tt-primary-50) !important; }
.tt-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.tt-table > tbody > tr > td { padding: 12px 14px; font-size: 14.5px; }
.tt-table > tbody > tr:last-child > td { border-bottom: 0 !important; }

/* --------------------------------------------------------------------------
   Pagination / Badge / Alert / Modal
   -------------------------------------------------------------------------- */
html body .pagination { gap: 6px; flex-wrap: wrap; }
html body .pagination .page-link {
    min-width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px !important;
    border: 1px solid var(--tt-line-2) !important;
    background: #fff !important;
    color: var(--tt-ink-2) !important;
    font-family: var(--tt-font);
    box-shadow: 0 2px 0 var(--tt-line);
}
html body .pagination .page-item.active .page-link {
    background: var(--tt-grad-v) !important;
    border-color: transparent !important;
    color: #fff !important;
    box-shadow: 0 3px 0 var(--tt-primary-700);
}
.tt-pager { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tt-pager button {
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: 12px;
    border: 1px solid var(--tt-line-2);
    background: #fff;
    color: var(--tt-ink-2);
    font: 500 14px var(--tt-font);
    cursor: pointer;
    box-shadow: 0 2px 0 var(--tt-line);
}
.tt-pager button.active { background: var(--tt-grad-v); color: #fff; border-color: transparent; box-shadow: 0 3px 0 var(--tt-primary-700); }
.tt-pager button:disabled { opacity: .45; cursor: default; }
html body .main-content-full .badge { border-radius: 999px; font-family: var(--tt-font); font-weight: 500; }
html body .main-content-full .alert { border-radius: 16px; border-width: 1px; font-family: var(--tt-font); }
html body .modal-content { border-radius: 24px !important; border: 1px solid var(--tt-line) !important; box-shadow: var(--tt-shadow-lg) !important; overflow: hidden; }
html body .modal-header { background: var(--tt-primary-50); border-bottom: 1px solid var(--tt-line) !important; }
html body .modal-title { font-family: var(--tt-font); color: var(--tt-heading); }

/* Dialog ของธีม */
.tt-modal { position: fixed; inset: 0; z-index: 2000; display: none; align-items: center; justify-content: center; padding: 16px; background: color-mix(in srgb, var(--tt-s) 30%, rgba(15, 18, 32, .45)); backdrop-filter: blur(4px); }
.tt-modal.open { display: flex; animation: ttFade .18s ease; }
.tt-modal-box { width: min(760px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #fff; border-radius: 26px; box-shadow: 0 30px 70px -20px rgba(15, 18, 32, .45); animation: ttPop .22s cubic-bezier(.2, .9, .3, 1.2); }
.tt-modal-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 22px; background: linear-gradient(180deg, var(--tt-primary-50), #fff); border-bottom: 1px solid var(--tt-line); }
.tt-modal-head h3 { margin: 0; font: 600 18px var(--tt-font); color: var(--tt-heading); display: flex; align-items: center; gap: 10px; }
.tt-modal-close { width: 38px; height: 38px; border-radius: 50%; border: 0; background: #f1f3f8; color: var(--tt-ink-2); font-size: 18px; cursor: pointer; }
.tt-modal-close:hover { background: #ffe8ec; color: #e11d48; }
.tt-modal-body { padding: 20px 22px 24px; }
@keyframes ttFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ttPop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.tt-empty { padding: 38px 16px; text-align: center; color: var(--tt-muted); font-family: var(--tt-font); }
.tt-empty i { display: block; font-size: 40px; color: var(--tt-primary-300); margin-bottom: 8px; }
.tt-flash { margin-bottom: 16px; }
.tt-live { display: inline-flex; align-items: center; gap: 6px; font: 500 12px var(--tt-font); color: #15803d; background: #e7f8ee; border-radius: 99px; padding: 4px 10px; }
.tt-live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); animation: ttLive 1.8s infinite; }
@keyframes ttLive { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); } 70% { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }

/* --------------------------------------------------------------------------
   หน้าเดิมทุกเมนู (หนังสือ / ยืม-คืน / จอง / สำรวจ / รายงาน / เจ้าหน้าที่ / ประวัติ)
   ปรับให้เป็นชุดเดียวกัน: การ์ด เงา มุมโค้ง หัวข้อ ปุ่ม ช่องกรอก
   -------------------------------------------------------------------------- */
/* การ์ด/กล่องหลัก */
html body .main-content-full :is(
    .lt-card, .borrow-card, .borrow-list-card, .borrow-fines-card, .borrow-rules-box, .borrow-rights-box,
    .resv-table-card, .resv-filter, .al-table-card, .al-filter-card, .rp-card, .um-panel, .um-table-panel, .um-filter-panel,
    .inventory-table-card, .inventory-card, .inventory-panel, .mbr-filter
) {
    background: #fff !important;
    border: 1px solid var(--tt-line) !important;
    border-radius: var(--tt-radius-lg) !important;
    box-shadow: var(--tt-shadow) !important;
}
/* หัวหน้า (hero) ของแต่ละเมนู */
/* หัวหน้าที่ออกแบบเป็นพื้นเข้ม + ตัวอักษรขาว (ยืม-คืน / จอง): ใช้พื้นเข้มโทนสีของระบบ ตัวอักษรจึงมองเห็นชัด */
html body .main-content-full :is(.borrow-list-hero, .borrow-create-hero, .resv-hero) {
    background: radial-gradient(520px 200px at 90% -20%, rgba(255, 255, 255, .22), transparent 70%), var(--tt-hero) !important;
    border: 0 !important;
    border-radius: var(--tt-radius-xl) !important;
    box-shadow: 0 2px 4px rgba(16, 24, 40, .1), 0 22px 40px -20px color-mix(in srgb, var(--tt-s) 70%, transparent) !important;
    color: #fff !important;
}
html body .main-content-full :is(.borrow-list-hero, .borrow-create-hero, .resv-hero) :is(h1, h2, .borrow-title) { color: #fff !important; text-shadow: 0 2px 8px rgba(0, 0, 0, .18) !important; font-family: var(--tt-font) !important; }
html body .main-content-full :is(.borrow-list-hero, .resv-hero) > div > p,
html body .main-content-full .borrow-create-hero .borrow-head .borrow-muted { color: rgba(255, 255, 255, .9) !important; }
html body .main-content-full :is(.borrow-list-hero, .resv-hero) :is(.borrow-btn, .resv-btn) { background: #fff !important; color: var(--tt-primary-700) !important; border: 0 !important; text-decoration: none !important; box-shadow: 0 4px 0 rgba(0, 0, 0, .15) !important; }
html body .main-content-full :is(
    .lt-title-card, .resv-top, .al-top, .rp-head,
    .um-heading, .inventory-hero, .inventory-head, .inventory-header
) {
    border-radius: var(--tt-radius-xl) !important;
    border: 1px solid var(--tt-line) !important;
    background:
        radial-gradient(520px 160px at 100% 0%, color-mix(in srgb, var(--tt-p) 12%, transparent), transparent 70%),
        #fff !important;
    box-shadow: var(--tt-shadow) !important;
}
html body .main-content-full :is(.lt-title-card h2, .resv-top h1, .al-title, .rp-title, .um-title, .inventory-title) {
    font-family: var(--tt-font) !important;
    color: var(--tt-heading) !important;
    font-weight: 700 !important;
    text-shadow: none !important;
    letter-spacing: -.01em;
}
html body .main-content-full :is(.al-subtitle, .rp-sub, .um-subtitle, .borrow-muted, .inventory-muted, .resv-subtext) { color: var(--tt-muted) !important; }
html body .main-content-full .lt-title-card > div:first-child > i,
html body .main-content-full :is(.al-heading-icon, .um-title-icon) {
    width: 52px; height: 52px; border-radius: 16px !important; display: inline-flex; align-items: center; justify-content: center;
    color: #fff !important; font-size: 22px !important;
    background: var(--tt-grad) !important;
    box-shadow: 0 4px 0 var(--tt-primary-700), 0 12px 20px -10px color-mix(in srgb, var(--tt-p) 70%, transparent) !important;
}

/* การ์ดตัวเลขสถิติ */
html body .main-content-full :is(.borrow-stat, .resv-stat, .al-stat, .inventory-stat) {
    background: #fff !important;
    border: 1px solid var(--tt-line) !important;
    border-radius: var(--tt-radius-lg) !important;
    box-shadow: var(--tt-shadow) !important;
    transition: transform .18s ease, box-shadow .18s ease;
}
html body .main-content-full :is(.borrow-stat, .resv-stat, .al-stat, .inventory-stat):hover { transform: translateY(-3px); box-shadow: var(--tt-shadow-lg) !important; }
html body .main-content-full :is(.resv-stat-value, .al-stat-number, .inventory-stat-value) { font-family: var(--tt-font) !important; color: var(--tt-heading) !important; }
html body .main-content-full :is(.resv-stat-label, .al-stat-label, .inventory-stat-label) { color: var(--tt-ink-2) !important; font-family: var(--tt-font) !important; }

/* ปุ่มหลักของหน้าเก่า */
html body .main-content-full :is(.lt-btn-primary, .borrow-btn-main, .resv-btn-primary, .inventory-btn-primary, .um-button, .al-btn, .lt-book-add-btn) {
    background: var(--tt-grad-v) !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 999px !important;
    font-family: var(--tt-font) !important;
    font-weight: 600 !important;
    text-shadow: none !important;
    box-shadow: 0 4px 0 var(--tt-primary-700), 0 10px 18px -8px color-mix(in srgb, var(--tt-p) 60%, transparent), var(--tt-inset) !important;
}
html body .main-content-full :is(.lt-book-tool-btn, .books-export-all-btn, .books-export-selected-btn, .resv-btn-outline, .borrow-filter-btn, .inventory-btn:not(.inventory-btn-primary)) {
    background: #fff !important;
    color: var(--tt-ink-2) !important;
    border: 1.5px solid var(--tt-line-2) !important;
    border-radius: 999px !important;
    font-family: var(--tt-font) !important;
    font-weight: 500 !important;
    box-shadow: 0 2px 0 var(--tt-line-2) !important;
}
/* ช่องกรอกของหน้าเก่า */
html body .main-content-full :is(.resv-input, .resv-select, .um-select, .um-search-input, .inventory-select, .al-search input, .borrow-form input, .borrow-form select) {
    border: 1.5px solid var(--tt-line-2) !important;
    border-radius: 14px !important;
    background-color: #fff !important;
    color: var(--tt-ink) !important;
}
html body .main-content-full :is(.resv-input, .resv-select, .um-select, .um-search-input, .inventory-select, .al-search input, .borrow-form input, .borrow-form select):focus {
    border-color: var(--tt-p) !important;
    box-shadow: var(--tt-ring) !important;
    outline: 0 !important;
}

/* ปุ่มไอคอน ดู / แก้ไข / ลบ ในตาราง */
html body .main-content-full .btn.rounded-circle[title] {
    width: 36px !important;
    height: 36px !important;
    border-radius: 12px !important;
    border: 1px solid transparent !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, .06) !important;
}
html body .main-content-full a[title="แก้ไข"].btn,
html body .main-content-full button[title="แก้ไข"].btn { background: #eaf2ff !important; color: #2563eb !important; border-color: #c7dbfe !important; }
html body .main-content-full a[title="ลบ"].btn,
html body .main-content-full button[title="ลบ"].btn { background: #ffeef1 !important; color: #e11d48 !important; border-color: #fecdd6 !important; }
html body .main-content-full a[title^="ดู"].btn,
html body .main-content-full button[title^="ดู"].btn { background: var(--tt-primary-50) !important; color: var(--tt-primary-600) !important; border-color: var(--tt-primary-200) !important; }
html body .main-content-full .btn.rounded-circle[title] i { color: inherit !important; }

/* ป้ายสถานะ Bootstrap → พาสเทลนุ่มตา */
html body .main-content-full .badge.bg-success { background: #e7f8ee !important; color: #15803d !important; border: 1px solid #c2ebd2; }
html body .main-content-full .badge.bg-warning { background: #fdf6d8 !important; color: #a16207 !important; border: 1px solid #f6e39b; }
html body .main-content-full .badge.bg-danger { background: #ffeef1 !important; color: #be123c !important; border: 1px solid #fecdd6; }
html body .main-content-full .badge.bg-info,
html body .main-content-full .badge.bg-primary { background: var(--tt-primary-50) !important; color: var(--tt-primary-700) !important; border: 1px solid var(--tt-primary-200); }
html body .main-content-full .badge.bg-secondary,
html body .main-content-full .badge.bg-light { background: #f2f4f8 !important; color: #5b6275 !important; border: 1px solid #e2e6ee; }

html body .main-content-full .book-cover-thumb { border-radius: 8px !important; box-shadow: 0 6px 14px -6px rgba(16, 24, 40, .35) !important; }

@media (max-width: 768px) {
    html body .main-content-full .lt-title-card { flex-direction: column; align-items: flex-start !important; gap: 12px; padding: 16px !important; }
    html body .main-content-full .lt-book-header-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
    html body .main-content-full .lt-book-header-actions > * { flex: 1 1 auto; justify-content: center; }
}

/* --------------------------------------------------------------------------
   Responsive — Tablet / Mobile (เมนูด้านข้างแบบเลื่อนเข้า-ออก)
   -------------------------------------------------------------------------- */
.tt-nav-backdrop { display: none; }

@media (max-width: 1280px) {
    .tt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media screen and (max-width: 992px) {
    html body .app-layout-wrapper { display: block !important; }
    html body .app-layout-wrapper .sidebar-left,
    html body .app-layout-wrapper.sidebar-collapsed .sidebar-left {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        z-index: 1500 !important;
        display: block !important;
        width: 280px !important;
        max-width: 86vw !important;
        min-width: 0 !important;
        height: 100% !important;
        max-height: none !important;
        padding: 18px 14px !important;
        border-radius: 0 26px 26px 0 !important;
        transform: translateX(-105%);
        transition: transform .26s cubic-bezier(.22, 1, .36, 1) !important;
        overflow-y: auto !important;
        background-color: #fff !important;
    }
    html body.tt-nav-open .app-layout-wrapper .sidebar-left { transform: translateX(0); }
    html body .app-layout-wrapper.sidebar-collapsed .sidebar-left > .text-center,
    html body .app-layout-wrapper.sidebar-collapsed .sidebar-left nav.nav { display: block !important; }
    html body .app-layout-wrapper .sidebar-left nav.nav { display: flex !important; flex-direction: column !important; }
    html body .app-layout-wrapper .sidebar-left .sidebar-item,
    html body .app-layout-wrapper.sidebar-collapsed .sidebar-item {
        font-size: 14.5px !important;
        padding: 8px 12px 8px 8px !important;
        justify-content: flex-start !important;
        gap: 12px !important;
        width: auto !important;
        white-space: nowrap !important;
    }
    html body .app-layout-wrapper .sidebar-left .sidebar-logo,
    html body .app-layout-wrapper .sidebar-left > .text-center img {
        display: block !important;
        width: 88px !important;
        height: 88px !important;
        max-width: 88px !important;
        margin: 0 auto !important;
    }
    html body #sidebarToggleBtn { display: none !important; }
    .tt-nav-backdrop { position: fixed; inset: 0; z-index: 1400; background: rgba(15, 18, 32, .42); backdrop-filter: blur(2px); }
    html body.tt-nav-open .tt-nav-backdrop { display: block; }
    html body.tt-nav-open { overflow: hidden; }
    html body .main-content-full,
    html body .app-layout-wrapper.sidebar-collapsed .main-content-full {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 16px 20px !important;
    }
    html body .main-content-full > .global-topbar { margin: 0 -16px 16px !important; padding: 8px 14px !important; min-height: 64px !important; }
}

@media screen and (max-width: 768px) {
    html body .global-brand-text small { display: none !important; }
    html body .global-brand-text strong { font-size: 16px !important; max-width: 50vw; }
    html body .global-topbar-home span,
    html body .global-topbar-logout span,
    html body .global-user-copy,
    html body .global-user-chevron { display: none !important; }
    html body .global-topbar-home { width: 42px !important; height: 42px !important; padding: 0 !important; justify-content: center !important; border-radius: 50% !important; border: 0 !important; background: transparent !important; }
    html body .global-topbar-logout { width: 42px !important; height: 42px !important; padding: 0 !important; justify-content: center !important; border-radius: 50% !important; }
    html body .global-user-menu > summary { width: 42px !important; height: 42px !important; padding: 0 !important; justify-content: center !important; border-radius: 50% !important; }
    html body .global-topbar-actions { gap: 7px !important; flex-wrap: nowrap !important; width: auto !important; }
    html body .global-user-menu { flex: 0 0 auto !important; }
    html body .global-brand { flex: 1 1 auto !important; min-width: 0; }
    .tt-bell > summary { width: 42px; height: 42px; font-size: 17px; }
    .tt-page-head { padding: 14px 16px; border-radius: 22px; }
    .tt-page-head h1 { font-size: 19px; }
    .tt-page-head .tt-ph-icon { flex-basis: 44px; width: 44px; height: 44px; font-size: 19px; border-radius: 14px; }
    .tt-page-head .tt-ph-actions { width: 100%; }
    .tt-page-head .tt-ph-actions .tt-btn { flex: 1 1 auto; }
    .tt-card { padding: 15px; border-radius: 20px; }
    .tt-stats { gap: 10px; }
    .tt-stat { min-height: 124px; padding: 14px; border-radius: 20px; }
    .tt-stat .tt-ico { width: 42px; height: 42px; font-size: 19px; border-radius: 13px; }
    .tt-stat .tt-stat-value { font-size: 22px; }
    .tt-stat .tt-stat-label { font-size: 13px; }
    .tt-toolbar .tt-field { flex: 1 1 140px; }
    .tt-bell-panel { position: fixed; left: 12px; right: 12px; top: 70px; width: auto; }
    html body .main-content-full table { min-width: 0; }
}

@media screen and (max-width: 420px) {
    html body .main-content-full { padding: 0 10px 16px !important; }
    html body .main-content-full > .global-topbar { margin: 0 -10px 12px !important; padding: 8px 10px !important; }
    html body .global-brand-text strong { font-size: 14.5px !important; }
    .tt-burger { flex-basis: 38px; width: 38px; height: 38px; font-size: 20px; margin-right: 2px; }
    html body .global-topbar-home,
    html body .global-topbar-logout,
    html body .global-user-menu > summary,
    .tt-bell > summary { width: 38px !important; height: 38px !important; }
    html body .global-topbar-home { display: none !important; }
}

@media print {
    .tt-burger, .tt-bell, .tt-nav-backdrop { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .tt-btn, .tt-stat, .tt-icon-btn, html body .sidebar-left .sidebar-item, .tt-modal-box { transition: none !important; animation: none !important; }
    .tt-live::before { animation: none; }
}
