
/* ══════════════════════════════════════
   DISCORD INTEGRATION — App-unified theme
══════════════════════════════════════ */
#view-discord {
    background: #000;
    /* 🐞 100vh บน Safari ใหญ่กว่าพื้นที่มองเห็นจริงตอนแถบเครื่องมือโผล่อยู่ — เดิมไม่มีผลเพราะ
       .app-view เคยบังคับความสูงตายตัวทับอยู่แล้ว ดู [[project_hqux_full_page_scroll]] 🌟 */
    min-height: 100vh; min-height: 100dvh;
    overflow-x: hidden; overflow-x: clip;   /* clip ไม่ใช่ hidden: hidden ทำให้แกน y เป็น auto → หน้านี้กลายเป็นกล่องเลื่อนซ้อนใต้หน้าต่างหลัก ลูกกลิ้งใน Chrome ค้าง (ดู index.html) */
}

.dsb-page {
    padding: 0 0 200px;
    max-width: 600px;
    margin: 0 auto;
    font-family: 'Inter','Noto Sans Thai',-apple-system,sans-serif;
}

/* ── Header ── */
.dsb-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: max(16px,env(safe-area-inset-top)) 20px 16px;
    position: sticky; top: 0; z-index: 100;
    background: rgba(0,0,0,.88);
    backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
    border-bottom: 1px solid rgba(255,255,255,.05);
}
.dsb-header-left { display: flex; align-items: center; gap: 14px; }
.dsb-back-btn {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: #1c1c1c; color: #fff; font-size: 20px;
    cursor: pointer; border: none; transition: .18s;
}
.dsb-back-btn:active { transform: scale(.9); }
.dsb-title { font-size: 20px; font-weight: 900; letter-spacing: -.5px; color: #fff; }
.dsb-status-pill {
    background: rgba(88,101,242,.12);
    color: #7289da;
    padding: 6px 14px; border-radius: 50px;
    font-size: 10px; font-weight: 800; letter-spacing: .1em;
    border: 1px solid rgba(88,101,242,.22);
}

/* ── Content padding ── */
.dsb-body { padding: 20px 20px 0; }

/* ── Card ── */
.dsb-card {
    background: #141414;
    border-radius: 20px; padding: 22px;
    margin-bottom: 16px;
    border: 1px solid rgba(255,255,255,.06);
}

.dsb-section-title {
    font-size: 10px; font-weight: 800; color: #7289da;
    text-transform: uppercase; letter-spacing: .2em;
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 18px;
}

/* ── Field ── */
.dsb-field { margin-bottom: 16px; }
.dsb-field:last-of-type { margin-bottom: 0; }
.dsb-label {
    font-size: 11px; font-weight: 700;
    color: rgba(255,255,255,.35);
    display: block; margin-bottom: 8px; padding-left: 2px;
    text-transform: uppercase; letter-spacing: .08em;
}
.dsb-input-wrap { position: relative; }
.dsb-input {
    width: 100%; background: #0d0d0d;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px; padding: 14px 48px 14px 16px;
    color: #fff; font-size: 14px; font-weight: 500;
    outline: none; transition: border-color .2s, box-shadow .2s;
    font-family: inherit; box-sizing: border-box;
}
.dsb-input:focus {
    border-color: #7289da;
    box-shadow: 0 0 0 3px rgba(88,101,242,.12);
}
.dsb-input-eye {
    position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    font-size: 18px; color: rgba(255,255,255,.25); cursor: pointer;
}
.dsb-hint {
    font-size: 12px; color: rgba(255,255,255,.3);
    margin-top: 8px; padding-left: 2px; line-height: 1.5;
}

/* ── Toggle rows ── */
.dsb-switch-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255,255,255,.05);
}
.dsb-switch-item:last-child { border-bottom: none; padding-bottom: 0; }
.dsb-switch-item:first-child { padding-top: 0; }
.dsb-switch-info { flex: 1; padding-right: 16px; }
.dsb-switch-title { font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 3px; }
.dsb-switch-desc  { font-size: 12px; color: rgba(255,255,255,.35); line-height: 1.4; }

.dsb-switch { position: relative; display: inline-block; width: 50px; height: 28px; flex-shrink: 0; }
.dsb-switch input { opacity: 0; width: 0; height: 0; }
.dsb-slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #2a2a2a; transition: .3s; border-radius: 28px;
}
.dsb-slider:before {
    position: absolute; content: "";
    height: 22px; width: 22px; left: 3px; bottom: 3px;
    background: #666; transition: .3s; border-radius: 50%;
}
input:checked + .dsb-slider { background: rgba(88,101,242,.25); }
input:checked + .dsb-slider:before { background: #7289da; transform: translateX(22px); }

/* ── Test button ── */
.dsb-test-btn {
    width: 100%; background: rgba(88,101,242,.08);
    color: #7289da;
    border: 1px dashed rgba(88,101,242,.25);
    padding: 15px; border-radius: 14px;
    font-weight: 800; font-size: 13px; cursor: pointer;
    transition: .2s; display: flex; align-items: center;
    justify-content: center; gap: 8px; font-family: inherit;
    letter-spacing: .04em;
}
.dsb-test-btn:active { background: rgba(88,101,242,.15); transform: scale(.98); }

/* ── Save bar — above bottom menu bar ── */
.dsb-save-bar {
    position: fixed;
    left: 0; right: 0;
    /* 70px = estimated bottom nav height + safe area */
    bottom: calc(max(70px, env(safe-area-inset-bottom) + 62px));
    padding: 12px 20px;
    background: linear-gradient(to top, rgba(0,0,0,.95) 60%, transparent);
    z-index: 200;
    display: flex; justify-content: center;
    pointer-events: none;
}
.dsb-save-btn {
    width: 100%; max-width: 540px;
    background: #fff; color: #000;
    border: none; padding: 17px;
    border-radius: 16px; font-weight: 900;
    font-size: 14px; cursor: pointer; letter-spacing: .02em;
    transition: .2s cubic-bezier(.34,1.56,.64,1);
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-family: inherit; pointer-events: auto;
}
.dsb-save-btn:active { transform: scale(.97); opacity: .9; }

/* ── Loading skeleton ── */
.dsb-loading-view {
    position: fixed; inset: 0; background: #000; z-index: 2000;
    padding: 20px; display: none;
    padding-top: max(20px, env(safe-area-inset-top));
}
.dsb-sk-header { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.dsb-sk-circle { width: 40px; height: 40px; border-radius: 50%; background: #1c1c1c; flex-shrink: 0; }
.dsb-sk-line   { height: 16px; border-radius: 8px; background: #1c1c1c; }
.dsb-grid-loader { display: flex; flex-direction: column; gap: 16px; }
.dsb-skeleton-card {
    border-radius: 20px; background: #111;
    position: relative; overflow: hidden;
}
.dsb-skeleton-card::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 30%, rgba(255,255,255,.03) 50%, transparent 70%);
    animation: dsbShimmer 1.4s linear infinite;
}
@keyframes dsbShimmer { from{transform:translateX(-100%)} to{transform:translateX(100%)} }
@keyframes dsb-fade-in  { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
