/* ============================================================
   maxky_rlzx — Unified UI (design system เดียวใช้ทุกหน้า)
   สีม่วงดำ ฟอนต์ Prompt/Inter มาตรฐานเดียวกันทั้งแอดมินและพอร์ทัล
   ============================================================ */

:root {
    --rlzx-bg: #090711;
    --rlzx-bg-2: #0d0a18;
    --rlzx-surface: #120e1d;
    --rlzx-surface-2: #171223;
    --rlzx-surface-3: #1b1629;
    --rlzx-border: rgba(167, 139, 250, .14);
    --rlzx-border-soft: rgba(167, 139, 250, .10);
    --rlzx-border-strong: rgba(167, 139, 250, .26);
    --rlzx-text: #f5f3fa;
    --rlzx-muted: #9d96ad;
    --rlzx-subtle: #70697d;
    --rlzx-primary: #a855f7;
    --rlzx-primary-2: #7c3aed;
    --rlzx-primary-soft: rgba(168, 85, 247, .10);
    --rlzx-secondary: #a78bfa;
    --rlzx-success: #34d399;
    --rlzx-success-soft: rgba(52, 211, 153, .10);
    --rlzx-warning: #fbbf24;
    --rlzx-warning-soft: rgba(251, 191, 36, .10);
    --rlzx-danger: #fb7185;
    --rlzx-danger-soft: rgba(251, 113, 133, .10);
    --rlzx-info: #c4b5fd;
    --rlzx-radius-card: 14px;
    --rlzx-radius-ctl: 10px;
    --rlzx-radius-sm: 8px;
    --rlzx-shadow: 0 14px 34px rgba(0, 0, 0, .22), 0 1px 0 rgba(255, 255, 255, .02) inset;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { min-height: 100%; background: var(--rlzx-bg); }
body, body.rlzx-body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--rlzx-text);
    background:
        radial-gradient(900px 480px at 88% -8%, rgba(124, 58, 237, .16), transparent 62%),
        radial-gradient(820px 420px at -8% 104%, rgba(168, 85, 247, .09), transparent 62%),
        linear-gradient(180deg, #090711 0%, #0d0a17 100%);
    font-family: 'Prompt', 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection { background: rgba(168, 85, 247, .30); color: #fff; }
:focus-visible { outline: 2px solid rgba(192, 132, 252, .72); outline-offset: 2px; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: #0d0a16; }
::-webkit-scrollbar-thumb { background: #2b2438; border-radius: 999px; border: 2px solid #0d0a16; }
::-webkit-scrollbar-thumb:hover { background: #5b3a7a; }

/* ===== ปุ่ม ===== */
.btn, .btn-neon, .btn-cyan, .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: var(--rlzx-radius-ctl);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease, opacity .15s ease;
}
.btn:hover, .btn-neon:hover, .btn-cyan:hover, .btn-ghost:hover { transform: translateY(-1px); }
.btn:active, .btn-neon:active, .btn-cyan:active, .btn-ghost:active { transform: translateY(0); }
.btn:disabled, .btn-neon:disabled, .btn-cyan:disabled, .btn-ghost:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm { min-height: 32px; padding: 6px 11px; font-size: 11px; border-radius: 9px; }
.btn-primary, .btn-neon, .btn-cyan {
    color: #fff;
    border-color: rgba(192, 132, 252, .38);
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    box-shadow: 0 10px 24px rgba(124, 58, 237, .20);
}
.btn-primary:hover, .btn-neon:hover, .btn-cyan:hover { box-shadow: 0 13px 30px rgba(124, 58, 237, .30); }
.btn-light, .btn-ghost {
    color: #d8d1e0;
    border-color: var(--rlzx-border);
    background: rgba(255, 255, 255, .03);
}
.btn-light:hover, .btn-ghost:hover { color: #fff; border-color: var(--rlzx-border-strong); background: rgba(255, 255, 255, .06); }
.btn-danger { color: #fda4af; border-color: rgba(251, 113, 133, .20); background: var(--rlzx-danger-soft); }
.btn-danger:hover { border-color: rgba(251, 113, 133, .38); background: rgba(251, 113, 133, .15); }
.btn-block { width: 100%; }
.icon-sm { width: 14px; height: 14px; flex: 0 0 14px; }
.icon-md { width: 18px; height: 18px; flex: 0 0 18px; }

/* ===== การ์ด ===== */
.card, .card-dark {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--rlzx-border);
    border-radius: var(--rlzx-radius-card);
    background: linear-gradient(180deg, rgba(21, 16, 34, .96), rgba(15, 12, 24, .96));
    box-shadow: var(--rlzx-shadow);
}
.card { margin-bottom: 14px; }
.card-dark { margin-bottom: 0; }
.card:last-child { margin-bottom: 0; }
.card-accent { border-top: 2px solid var(--rlzx-primary); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; color: #f7f4fa; font-size: 15px; line-height: 1.35; letter-spacing: -.01em; }
.card-head p { margin: 3px 0 0; color: var(--rlzx-muted); font-size: 11px; line-height: 1.55; }
.eyebrow { margin: 0 0 3px; color: #7f7691; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.text-link { color: #c084fc; font-size: 11px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.text-link:hover { color: #e9d5ff; }

/* ===== แจ้งเตือน ===== */
.flash {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 14px;
    padding: 11px 14px;
    border: 1px solid;
    border-radius: var(--rlzx-radius-ctl);
    font-size: 12px;
    line-height: 1.5;
}
.flash.success { color: #86efac; background: var(--rlzx-success-soft); border-color: rgba(52, 211, 153, .20); }
.flash.error { color: #fda4af; background: var(--rlzx-danger-soft); border-color: rgba(251, 113, 133, .20); }

/* ===== อินพุต ===== */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.form-grid .wide, .form-actions.wide { grid-column: 1 / -1; }
.form-grid label, .inline-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    color: #9d95a9;
    font-size: 11px;
    font-weight: 600;
}
.form-grid input, .form-grid select, .form-grid textarea, .inline-form input, .inline-form select,
.input-dark {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(167, 139, 250, .13);
    border-radius: var(--rlzx-radius-ctl);
    outline: none;
    color: #f0ecf5;
    background: rgba(6, 5, 10, .45);
    font: inherit;
    font-size: 12.5px;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.form-grid textarea { min-height: 96px; resize: vertical; }
.form-grid input::placeholder, .form-grid textarea::placeholder, .inline-form input::placeholder, .input-dark::placeholder { color: #625b6b; }
.form-grid input[type="file"] { padding: 7px; color: #8e869a; }
.form-grid input[type="file"]::file-selector-button, .input-dark::file-selector-button { margin-right: 8px; padding: 7px 11px; border: 0; border-radius: 8px; color: #eee8f5; background: rgba(168, 85, 247, .14); font: inherit; font-weight: 600; cursor: pointer; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .inline-form input:focus, .inline-form select:focus, .input-dark:focus {
    border-color: rgba(192, 132, 252, .45);
    background: rgba(10, 7, 17, .72);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, .08);
}
.form-grid select option, .inline-form select option { color: #eee8f5; background: #161022; }
input[type="checkbox"], .check-row input, .check-inline input, .toggle-field input { accent-color: #a855f7; width: 1.15rem; height: 1.15rem; cursor: pointer; }
.form-grid small { color: #6f687a; font-size: 10px; font-weight: 500; line-height: 1.5; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.field-label { display: block; font-size: 11px; color: var(--rlzx-muted); margin-bottom: 6px; font-weight: 600; letter-spacing: .04em; }
.check-inline, .toggle-field { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 8px !important; color: #a59daf !important; font-size: 11px !important; font-weight: 600 !important; }
.check-inline input, .toggle-field input { width: auto !important; }
.inline-form { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; max-width: 100%; }
.inline-form input { width: 130px; }
.inline-form select { width: auto; max-width: 260px; }
.sr-only-field { position: absolute; left: -9999px; opacity: 0; }

/* ===== badge ===== */
.badge {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    min-height: 23px; padding: 4px 10px;
    border: 1px solid rgba(167, 139, 250, .11); border-radius: 999px;
    font-size: 10.5px; font-weight: 700; line-height: 1; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.ok { color: #86efac; border-color: rgba(52, 211, 153, .16); background: var(--rlzx-success-soft); }
.badge.warn { color: #fde68a; border-color: rgba(251, 191, 36, .16); background: var(--rlzx-warning-soft); }
.badge.danger { color: #fda4af; border-color: rgba(251, 113, 133, .16); background: var(--rlzx-danger-soft); }
.badge.muted { color: #9f97ab; border-color: rgba(148, 163, 184, .12); background: rgba(148, 163, 184, .07); }
.badge.info { color: #d8b4fe; border-color: rgba(168, 85, 247, .16); background: var(--rlzx-primary-soft); }

/* ===== ตาราง ===== */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid rgba(167, 139, 250, .08); border-radius: 11px; background: rgba(7, 5, 12, .18); }
.table-wrap table { width: 100%; min-width: 640px; border-collapse: collapse; }
.table-wrap th {
    position: sticky; top: 0; z-index: 1;
    padding: 10px 12px; border-bottom: 1px solid rgba(167, 139, 250, .10);
    color: #8d8598; background: #151022; font-size: 10.5px; font-weight: 700; text-align: left; white-space: nowrap;
}
.table-wrap td { padding: 10px 12px; border-bottom: 1px solid rgba(167, 139, 250, .06); color: #cbc4d4; font-size: 12px; vertical-align: top; }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap tbody tr:hover td { background: rgba(168, 85, 247, .03); }
.muted-cell { max-width: 460px; color: #777081 !important; }
.empty { padding: 30px 14px !important; color: #746c7f !important; text-align: center; font-size: 11.5px !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; word-break: break-all; }
.strong-num { color: #fff; font-weight: 700; }

/* ตารางฝั่งพอร์ทัล (Tailwind) ให้หน้าตาเดียวกับแอดมิน */
.card-dark table { width: 100%; border-collapse: collapse; }
.card-dark table th {
    padding: 10px 12px; border-bottom: 1px solid rgba(167, 139, 250, .10);
    color: #8d8598; background: #151022; font-size: 10.5px; font-weight: 700; text-align: left; white-space: nowrap;
}
.card-dark table td { padding: 10px 12px; border-bottom: 1px solid rgba(167, 139, 250, .06); color: #cbc4d4; font-size: 12.5px; }
.card-dark table tr:last-child td { border-bottom: 0; }
.card-dark table tbody tr:hover { background: rgba(168, 85, 247, .03); }

/* ===== shell: sidebar + topbar (แอดมินและพอร์ทัลใช้ร่วมกัน) ===== */
.rlzx-shell { min-height: 100vh; display: flex; }
.rlzx-sidebar, .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 248px;
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    z-index: 60;
    background: rgba(12, 9, 19, .94);
    border-right: 1px solid var(--rlzx-border);
    box-shadow: 16px 0 50px rgba(0, 0, 0, .12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transition: width .22s ease, transform .22s ease;
}
.rlzx-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; margin-bottom: 8px; border-bottom: 1px solid rgba(167, 139, 250, .08); }
.brand-mark {
    width: 40px; height: 40px; flex: 0 0 40px;
    display: grid; place-items: center; overflow: hidden;
    border: 1px solid rgba(192, 132, 252, .25); border-radius: 12px;
    color: #fff;
    background: linear-gradient(145deg, rgba(168, 85, 247, .28), rgba(124, 58, 237, .12));
    box-shadow: 0 10px 24px rgba(124, 58, 237, .18), inset 0 1px 0 rgba(255, 255, 255, .05);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-mark span { font-size: 15px; font-weight: 800; letter-spacing: .04em; }
.rlzx-brand strong { display: block; color: #f2eef7; font-size: 13.5px; font-weight: 700; letter-spacing: .01em; }
.rlzx-brand small, .admin-mini small { display: block; margin-top: 2px; color: var(--rlzx-muted); font-size: 10px; }
.sidebar-label { transition: opacity .15s ease; }

.rlzx-nav, .sidebar nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; padding-right: 2px; flex: 1; }
.rlzx-nav-group { margin: 12px 7px 5px; color: #5f586c; font-size: 9.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.rlzx-nav a, .logout-link, .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #a9a2b7;
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 500;
    transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.rlzx-nav a:hover, .logout-link:hover, .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .035); border-color: rgba(167, 139, 250, .09); }
.rlzx-nav a.nav-active, .nav-link.active {
    color: #fff;
    font-weight: 700;
    background: linear-gradient(90deg, rgba(168, 85, 247, .16), rgba(124, 58, 237, .06));
    border-color: rgba(168, 85, 247, .24);
    box-shadow: inset 3px 0 0 #a855f7;
}
.nav-icon { width: 17px; height: 17px; flex: 0 0 17px; opacity: .92; }

.rlzx-side-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(167, 139, 250, .08); }
.admin-mini { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 10px 10px; }
.admin-mini strong { display: block; overflow: hidden; color: #ede9fe; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .10); }
.logout-link { justify-content: center; min-height: 38px; border-color: var(--rlzx-border); background: rgba(255, 255, 255, .02); }

.rlzx-main, .main-area {
    width: calc(100% - 248px);
    max-width: 1680px;
    min-width: 0;
    margin-left: 248px;
    padding: 20px 24px 44px;
    transition: margin-left .22s ease, width .22s ease;
}
.rlzx-sidebar.collapsed, .sidebar.collapsed { width: 72px; }
.rlzx-sidebar.collapsed .rlzx-brand > div:last-child,
.rlzx-sidebar.collapsed .rlzx-nav-group,
.rlzx-sidebar.collapsed .sidebar-label,
.rlzx-sidebar.collapsed .admin-mini > div,
.sidebar.collapsed .sidebar-label { display: none; }
.rlzx-sidebar.collapsed .rlzx-brand, .sidebar.collapsed .p-5 { justify-content: center; padding-left: 0; padding-right: 0; }
.rlzx-sidebar.collapsed .rlzx-nav a, .rlzx-sidebar.collapsed .logout-link,
.sidebar.collapsed .nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
.rlzx-sidebar.collapsed + .rlzx-main, .main-area.shifted { width: calc(100% - 72px); margin-left: 72px; }

.rlzx-topbar, .topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 60px;
    margin-bottom: 14px;
    padding: 6px 0 12px;
    background: rgba(9, 7, 17, .86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(167, 139, 250, .08);
}
.rlzx-topbar h1 { margin: 0; color: #f8f7fb; font-size: 20px; line-height: 1.2; letter-spacing: -.02em; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.rlzx-mobile-toggle {
    display: none;
    width: 38px; height: 38px; padding: 0;
    border: 1px solid var(--rlzx-border);
    border-radius: 10px;
    color: #e9e3f1;
    background: rgba(255, 255, 255, .03);
    cursor: pointer;
}
.rlzx-mobile-toggle svg { width: 18px; height: 18px; margin: auto; }
.rlzx-overlay { display: none; }

/* ===== metrics / misc cards ===== */
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.metric-card {
    position: relative;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    overflow: hidden;
    border: 1px solid var(--rlzx-border);
    border-radius: var(--rlzx-radius-card);
    background: linear-gradient(180deg, rgba(22, 17, 35, .96), rgba(17, 13, 28, .96));
    box-shadow: var(--rlzx-shadow);
}
.metric-icon {
    width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center;
    border: 1px solid rgba(168, 85, 247, .18); border-radius: 12px; color: #d8b4fe; background: rgba(168, 85, 247, .10);
}
.metric-icon.warn { color: #fcd34d; border-color: rgba(251, 191, 36, .15); background: var(--rlzx-warning-soft); }
.metric-card small { display: block; color: #8e869a; font-size: 11px; font-weight: 600; }
.metric-card strong { display: block; margin-top: 2px; color: #fff; font-size: 24px; line-height: 1.15; letter-spacing: -.03em; }
.metric-card p { margin: 2px 0 0; color: #6f687a; font-size: 10px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-2 > .card, .grid-2 > .card-dark { margin-bottom: 0; }
.flow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.flow > div {
    display: grid; grid-template-columns: 30px 1fr; column-gap: 9px; row-gap: 2px;
    min-width: 0; padding: 10px;
    border: 1px solid rgba(167, 139, 250, .10); border-radius: 10px;
    background: rgba(255, 255, 255, .017);
}
.flow b { width: 30px; height: 30px; display: grid; place-items: center; grid-row: span 2; border-radius: 9px; color: #d8b4fe; background: rgba(168, 85, 247, .10); font-size: 11px; }
.flow span { min-width: 0; color: #eee8f5; font-size: 11.5px; font-weight: 700; }
.flow small { color: var(--rlzx-muted); font-size: 10.5px; line-height: 1.5; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(167, 139, 250, .07); }
.status-row:last-child { border-bottom: 0; }
.status-row > div:first-child { min-width: 0; }
.status-row strong { display: block; overflow-wrap: anywhere; color: #eae5ef; font-size: 11.5px; font-weight: 700; }
.status-row small { display: block; max-width: 720px; margin-top: 3px; color: var(--rlzx-muted); font-size: 10.5px; line-height: 1.5; overflow-wrap: anywhere; }
.note-list > div { padding: 10px 0; border-bottom: 1px solid rgba(167, 139, 250, .07); }
.note-list > div:last-child { border-bottom: 0; }
.note-list b { display: block; color: #e9e3ef; font-size: 11.5px; }
.note-list span { display: block; margin-top: 3px; color: var(--rlzx-muted); font-size: 10.5px; line-height: 1.5; }
.info-banner {
    display: flex; align-items: flex-start; gap: 11px;
    margin-bottom: 14px; padding: 12px;
    border: 1px solid rgba(168, 85, 247, .14); border-radius: 12px;
    background: linear-gradient(90deg, rgba(168, 85, 247, .08), rgba(124, 58, 237, .03));
}
.banner-icon { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border: 1px solid rgba(168, 85, 247, .15); border-radius: 10px; color: #d8b4fe; background: rgba(168, 85, 247, .10); }
.info-banner strong { display: block; color: #eee8f5; font-size: 11.5px; }
.info-banner p { margin: 3px 0 0; color: var(--rlzx-muted); font-size: 10.5px; line-height: 1.55; }
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stack-list { display: flex; flex-direction: column; }
.stack-list .status-row { align-items: flex-start; }
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.sub-head h3 { margin: 0; color: #e9e3ef; font-size: 12px; }
.sub-head span { color: #756d80; font-size: 10px; }

/* ===== catalog ===== */
.catalog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.catalog-toolbar h2 { margin: 2px 0 4px; font-size: 17px; color: #f4f0f7; }
.catalog-toolbar p:not(.eyebrow) { margin: 0; color: var(--rlzx-muted); font-size: 11px; line-height: 1.5; }
.catalog-toolbar-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.catalog-count { display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border: 1px solid var(--rlzx-border); border-radius: 9px; color: #aaa1b2; background: rgba(255, 255, 255, .02); font-size: 10.5px; }
.catalog-list { display: grid; gap: 10px; }
.product-summary-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; }
.product-summary-main { min-width: 0; flex: 1 1 auto; }
.product-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.product-logo { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(167, 139, 250, .13); border-radius: 12px; color: #908699; background: rgba(168, 85, 247, .07); }
.product-logo img { width: 100%; height: 100%; object-fit: cover; }
.product-title h2 { margin: 0; color: #f4f0f7; font-size: 14px; }
.product-title p { margin: 3px 0 0; color: var(--rlzx-muted); font-size: 10.5px; }
.product-summary-packages { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.package-count { color: #8f8798; font-size: 10px; font-weight: 600; }
.package-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid rgba(167, 139, 250, .10); border-radius: 8px; color: #a9a0b2; background: rgba(168, 85, 247, .035); font-size: 10.5px; line-height: 1; }
.package-chip .chip-btn { display: inline-flex; gap: 5px; border-left: 1px solid rgba(167, 139, 250, .12); padding-left: 6px; }
.package-chip .chip-btn a { color: #c4b5fd; text-decoration: none; font-size: 10px; }
.package-chip .chip-btn a:hover { color: #fff; }
.package-chip.more { color: #c4b5fd; border-color: rgba(168, 85, 247, .18); background: rgba(168, 85, 247, .08); }

/* ===== users / pricing ===== */
.user-picker { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.user-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid var(--rlzx-border); border-radius: 9px; color: #aaa1b2; background: rgba(255, 255, 255, .02); text-decoration: none; font-size: 10.5px; }
.user-pill:hover { color: #fff; border-color: var(--rlzx-border-strong); }
.user-pill span { color: #6d6577; }
.user-pill.selected { color: #f3e8ff; border-color: rgba(168, 85, 247, .28); background: rgba(168, 85, 247, .11); }
.price-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; padding-right: 4px; }
.price-product { padding: 10px; border: 1px solid rgba(167, 139, 250, .09); border-radius: 10px; background: rgba(255, 255, 255, .015); }
.check-row { display: flex; align-items: flex-start; gap: 8px; font-size: 11px; cursor: pointer; }
.check-row input { margin-top: 3px; }
.check-row span { display: flex; flex-direction: column; min-width: 0; color: #ded8e4; }
.check-row small { margin-top: 2px; color: #746d7e; font-size: 10px; }
.price-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; padding: 7px 0 0; border-top: 1px solid rgba(167, 139, 250, .06); color: #817988; font-size: 10.5px; }
.price-row input { width: 130px; }
.product-price-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.price-inline { display: flex !important; flex-direction: row !important; align-items: center; gap: 7px !important; color: #817988 !important; font-size: 10.5px !important; }
.price-inline input { width: 120px; }

/* ===== integrations ===== */
.integration-card { padding: 16px; }
.api-form { margin-bottom: 12px; }
.api-advanced { padding: 10px 0; border-top: 1px solid var(--rlzx-border); }
.api-advanced summary { color: #d8b4fe; cursor: pointer; font-size: 11px; font-weight: 600; padding: 8px 0; }
.api-advanced .form-grid { margin-top: 10px; }
.api-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding-top: 11px; border-top: 1px solid rgba(167, 139, 250, .07); }
.api-meta { margin-left: auto; max-width: 55%; color: #6f687a; font-size: 10px; line-height: 1.5; text-align: right; }

/* ===== modals ===== */
.modal-overlay {
    position: fixed; inset: 0; z-index: 150;
    display: flex; align-items: center; justify-content: center;
    padding: 14px;
    background: rgba(5, 4, 9, .72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    overflow-y: auto;
}
.modal-overlay.hidden { display: none; }
.modal-box {
    width: 100%;
    max-width: 30rem;
    max-height: 88vh;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(22, 17, 35, .98), rgba(15, 12, 24, .98));
    border: 1px solid var(--rlzx-border-strong);
    border-radius: var(--rlzx-radius-card);
    padding: 18px;
    box-shadow: 0 24px 70px -18px rgba(0, 0, 0, .85);
    animation: rlzxModalIn .18s ease-out;
}
.modal-box.modal-wide { max-width: 40rem; }
@keyframes rlzxModalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h3 { margin: 0; color: #f7f4fa; font-size: 15px; line-height: 1.35; }
.modal-head p { margin: 3px 0 0; color: var(--rlzx-muted); font-size: 11px; }
.modal-close { padding: 4px; border: 0; border-radius: 8px; color: #8d8598; background: transparent; cursor: pointer; }
.modal-close:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.modal-close svg { width: 17px; height: 17px; display: block; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(167, 139, 250, .08); }
.modal-body .form-grid { margin: 0; }
.modal-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.modal-stat { padding: 10px; border: 1px solid var(--rlzx-border); border-radius: 10px; background: rgba(255, 255, 255, .02); text-align: center; }
.modal-stat b { display: block; color: #fff; font-size: 16px; }
.modal-stat span { color: var(--rlzx-muted); font-size: 10px; }
.slip-preview { display: block; max-width: 100%; max-height: 46vh; margin: 0 auto 12px; border-radius: 10px; border: 1px solid var(--rlzx-border); background: #fff; padding: 6px; }

/* ===== portal: ขั้นตอนซื้อ / tabs ===== */
.channel-tab, .section-tab { background-color: rgba(8, 6, 14, .54); }
.channel-tab.tab-active { background: rgba(168, 85, 247, .12); border-color: rgba(168, 85, 247, .65) !important; color: #d8b4fe; }
.section-tab.tab-active { background: var(--rlzx-primary); border-color: transparent !important; color: #fff; }
.step-dot {
    width: 30px; height: 30px; border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(8, 6, 14, .70); border: 1px solid var(--rlzx-border);
    color: #8d8597; font-size: 12px; font-weight: 600; transition: all .2s ease;
}
.step-dot.active { background: rgba(168, 85, 247, .14); border-color: rgba(168, 85, 247, .55); color: #d8b4fe; }
.step-line { width: 30px; height: 2px; background: var(--rlzx-border); border-radius: 999px; }
.qty-btn {
    width: 46px; height: 46px; border-radius: 12px;
    background: rgba(8, 6, 14, .70); border: 1px solid var(--rlzx-border);
    color: #d1cad9; font-size: 22px; font-weight: 600; transition: all .2s ease; flex-shrink: 0;
    cursor: pointer;
}
.qty-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .07); color: #fff; border-color: rgba(168, 85, 247, .4); }
.qty-btn:disabled { opacity: .35; cursor: not-allowed; }
.qty-display { min-width: 56px; text-align: center; font-size: 22px; font-weight: 700; color: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.package-option {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    padding: 11px 13px; border-radius: 11px; border: 1px solid var(--rlzx-border);
    background: rgba(0, 0, 0, .24); cursor: pointer; color: #e9e3ef; font-size: 13px; transition: all .2s ease;
    text-align: left; width: 100%;
}
.package-option:hover { border-color: #6f6480; }
.package-option.pkg-active { border-color: rgba(168, 85, 247, .55); background: rgba(168, 85, 247, .12); color: #fff; }

/* ===== empty state / loading ===== */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 34px 16px; color: #8d8597; text-align: center; }
.empty-state h2 { margin: 0; color: #f0ebf4; font-size: 16px; }
.empty-state p { margin: 0; color: var(--rlzx-muted); font-size: 11px; }
.empty-icon {
    width: 46px; height: 46px; border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(168, 85, 247, .08); border: 1px solid rgba(168, 85, 247, .12);
}
.loading-overlay {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    background: rgba(5, 4, 9, .70);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.loading-overlay.hidden { display: none; }
.spinner {
    width: 38px; height: 38px; border-radius: 999px;
    border: 3px solid rgba(168, 85, 247, .12);
    border-top-color: #a855f7;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: rlzxFadeIn .4s ease-out forwards; }
@keyframes rlzxFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== login orbs ===== */
.login-orb { position: fixed; border-radius: 50%; filter: blur(120px); pointer-events: none; z-index: 0; }
.login-orb-a { top: -12%; left: -10%; width: 320px; height: 320px; background: rgba(168, 85, 247, .16); }
.login-orb-b { bottom: -12%; right: -10%; width: 380px; height: 380px; background: rgba(124, 58, 237, .10); }
.rlzx-auth { display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-shell { width: min(420px, 100%); position: relative; z-index: 1; }
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand h1 { margin: 12px 0 4px; font-size: 27px; font-weight: 700; letter-spacing: -.02em; }
.login-brand p { margin: 0; color: var(--rlzx-muted); font-size: 12px; }
.login-card { padding: 22px; }
.login-form { display: grid; gap: 13px; }
.login-label { display: grid; gap: 7px; color: #9d96ad; font-size: 11px; font-weight: 600; }
.login-label input { width: 100%; padding: 11px 13px; font: inherit; font-size: 13px; }
.login-note { margin: 18px 0 0; text-align: center; color: #6f687a; font-size: 10.5px; line-height: 1.6; }

/* ===== palette lock: เทียบสี Tailwind เป็นม่วงชุดเดียว ===== */
.text-primary { color: #d8b4fe !important; }
.text-secondary { color: #c4b5fd !important; }
.bg-primary\/10 { background-color: rgba(168, 85, 247, .10) !important; }
.bg-primary\/15 { background-color: rgba(168, 85, 247, .15) !important; }
.bg-primary\/20 { background-color: rgba(168, 85, 247, .20) !important; }
.bg-secondary\/10 { background-color: rgba(167, 139, 250, .10) !important; }
.border-primary { --tw-border-opacity: 1; border-color: rgb(168 85 247/var(--tw-border-opacity, 1)) !important; }
.border-primary\/20 { border-color: rgba(168, 85, 247, .20) !important; }
.border-primary\/30 { border-color: rgba(168, 85, 247, .30) !important; }
.border-secondary\/30 { border-color: rgba(167, 139, 250, .30) !important; }
.border-t-primary { border-top-color: #a855f7 !important; }
.border-l-primary { border-left-color: #a855f7 !important; }
.from-primary { --tw-gradient-from: #a855f7 var(--tw-gradient-from-position); --tw-gradient-to: rgba(168, 85, 247, 0) var(--tw-gradient-to-position); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); }
.from-primaryDark { --tw-gradient-from: #7c3aed var(--tw-gradient-from-position); --tw-gradient-to: rgba(124, 58, 237, 0) var(--tw-gradient-to-position); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); }
.to-primary { --tw-gradient-to: #a855f7 var(--tw-gradient-to-position); }
.to-secondary { --tw-gradient-to: #a78bfa var(--tw-gradient-to-position); }
.shadow-primary\/30 { --tw-shadow-color: rgba(168, 85, 247, .30); --tw-shadow: var(--tw-shadow-colored); }
.hover\:bg-primary:hover { --tw-bg-opacity: 1; background-color: rgb(168 85 247/var(--tw-bg-opacity, 1)) !important; }
.hover\:border-primary\/30:hover { border-color: rgba(168, 85, 247, .30) !important; }
.hover\:border-primary\/40:hover { border-color: rgba(168, 85, 247, .40) !important; }
.hover\:bg-secondary\/10:hover { background-color: rgba(167, 139, 250, .10) !important; }
.file\:bg-primary\/20::file-selector-button { background-color: rgba(168, 85, 247, .20) !important; }
.file\:text-primary::file-selector-button { --tw-text-opacity: 1; color: rgb(216 180 254/var(--tw-text-opacity, 1)) !important; }
.hover\:file\:bg-primary\/30::file-selector-button:hover { background-color: rgba(168, 85, 247, .30) !important; }
.selection\:bg-primary\/30 ::selection,
.selection\:bg-primary\/30::selection { background-color: rgba(168, 85, 247, .30) !important; }
/* พอร์ทัลใช้สี emerald/amber/rose เดิมของ Tailwind แต่ให้เข้ากับชุดม่วง */
.bg-emerald-500\/10 { background-color: rgba(52, 211, 153, .10) !important; }
.text-emerald-400 { color: #6ee7b7 !important; }
.bg-amber-500\/10 { background-color: rgba(251, 191, 36, .10) !important; }
.text-amber-400 { color: #fcd34d !important; }
.bg-rose-500\/10 { background-color: rgba(251, 113, 133, .10) !important; }
.text-rose-400 { color: #fda4af !important; }
.border-emerald-500\/20 { border-color: rgba(52, 211, 153, .20) !important; }
.border-amber-500\/20, .border-amber-500\/30 { border-color: rgba(251, 191, 36, .22) !important; }
.border-rose-500\/20, .border-rose-500\/30 { border-color: rgba(251, 113, 133, .22) !important; }

/* ===== responsive ===== */
@media (max-width: 1120px) {
    .rlzx-sidebar, .sidebar { width: 224px; }
    .rlzx-main, .main-area { width: calc(100% - 224px); margin-left: 224px; padding-left: 18px; padding-right: 18px; }
    .rlzx-sidebar.collapsed + .rlzx-main, .main-area.shifted { width: calc(100% - 72px); margin-left: 72px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .product-summary-card { align-items: flex-start; flex-direction: column; }
    .product-summary-card > .row-actions { width: 100%; }
}
@media (max-width: 760px) {
    body, body.rlzx-body { font-size: 12.5px; }
    .rlzx-shell { display: block; }
    .rlzx-sidebar, .sidebar {
        width: min(280px, 86vw);
        height: 100vh;
        transform: translateX(-105%);
        padding-top: 12px;
        box-shadow: 18px 0 50px rgba(0, 0, 0, .36);
    }
    .rlzx-sidebar.open, .sidebar.open { transform: translateX(0); }
    .rlzx-main, .main-area,
    .rlzx-sidebar.collapsed + .rlzx-main, .main-area.shifted {
        width: 100%;
        margin-left: 0;
        padding: 12px 12px 30px;
    }
    .rlzx-overlay {
        position: fixed; inset: 0; z-index: 50;
        display: block;
        background: rgba(5, 4, 9, .62);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        opacity: 0; pointer-events: none;
        transition: opacity .2s ease;
    }
    .rlzx-overlay.active { opacity: 1; pointer-events: auto; }
    .rlzx-mobile-toggle { display: inline-grid; place-items: center; flex: 0 0 38px; }
    .rlzx-topbar, .topbar { align-items: center; padding-bottom: 10px; }
    .rlzx-topbar h1 { font-size: 17px; }
    .top-actions .to-store { display: none; }
    .metric-grid { grid-template-columns: 1fr; gap: 9px; }
    .metric-card { padding: 13px; }
    .metric-card strong { font-size: 21px; }
    .form-grid { grid-template-columns: 1fr; gap: 9px; }
    .flow { grid-template-columns: 1fr; }
    .card, .card-dark { padding: 13px; margin-bottom: 11px; }
    .card-head h2 { font-size: 14px; }
    .table-wrap table { min-width: 560px; }
    .modal-overlay { padding: 8px; align-items: flex-end; }
    .modal-box { max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; padding: 15px; }
    .modal-stat b { font-size: 15px; }
    .api-meta { width: 100%; max-width: none; margin-left: 0; text-align: left; }
    .catalog-toolbar { align-items: flex-start; flex-direction: column; gap: 10px; }
    .catalog-toolbar-actions { width: 100%; justify-content: space-between; }
    .product-summary-card { padding: 12px; }
    .login-shell { width: 100%; }
    .login-card { padding: 16px; }
    .qty-btn { width: 44px; height: 44px; }
    .buy-modal-card { padding: 14px !important; }
}
@media (max-width: 420px) {
    .rlzx-main, .main-area { padding-left: 10px; padding-right: 10px; }
    .metric-card { padding: 11px; }
    .metric-card strong { font-size: 20px; }
    .btn { padding-left: 11px; padding-right: 11px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
