/* =====================================================
   SETTINGS PAGE V3 — Premium Admin Dashboard
   Redesigned 2026 | Responsive 320px → 1400px+
   Enhanced UI/UX with modern glassmorphism effects
   ===================================================== */

:root {
    --s-sidebar-w: 260px;
    --s-gap: 24px;
    --s-radius: 20px;
    --s-pad: 24px;
    --s-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Wrapper — Fullscreen Dashboard Mode */
.settings-page-wrapper { 
    overflow-x: hidden; 
    width: 100%; 
    min-height: 100vh;
    background: 
        radial-gradient(circle at 10% 10%, rgba(239, 68, 68, 0.09), transparent 45%),
        radial-gradient(circle at 90% 90%, rgba(139, 92, 246, 0.07), transparent 45%),
        var(--bg-zinc-950);
}

.s-wrap {
    background: linear-gradient(135deg, rgba(24,24,27,0.95) 0%, rgba(18,18,21,0.98) 100%);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    padding: 24px 32px;
    border-radius: 0;
    border: none;
    box-shadow: none;
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
    transition: var(--s-transition);
}

@media (max-width: 767px) { 
    .s-wrap { 
        padding: 16px 14px; 
        margin: 0; 
        border-radius: 0;
    } 
}
@media (max-width: 400px) { 
    .s-wrap { 
        padding: 12px 10px; 
        margin: 0; 
        border-radius: 0;
    } 
}

/* Header bar — Premium Design */
.s-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(239,68,68,0.08) 0%, rgba(139,92,246,0.06) 100%);
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 
        0 0 0 1px rgba(239,68,68,0.1) inset,
        0 10px 30px rgba(0,0,0,0.2);
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

.s-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(239,68,68,0.6) 20%, 
        rgba(139,92,246,0.6) 80%, 
        transparent 100%);
}

.s-header-title {
    font-size: clamp(18px, 3.5vw, 26px);
    font-weight: 900;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.s-header-title > span:first-child {
    font-size: 1.4em;
    filter: drop-shadow(0 0 10px rgba(239,68,68,0.5));
}

.s-header-title-text {
    background: linear-gradient(135deg, #fff 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 520px) { 
    .s-header { padding: 16px 18px; margin-bottom: 20px; }
    .s-header-title-text { display: none; } 
}

.s-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.s-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    padding: 9px 16px;
    border-radius: 12px;
    border: 1px solid;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: var(--s-transition);
    font-family: var(--font-family);
    background: none;
    position: relative;
    overflow: hidden;
}

.s-header-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.s-header-btn:hover::before {
    opacity: 1;
}

.s-btn-neutral { 
    color: #fff; 
    background: rgba(255,255,255,0.06); 
    border-color: rgba(255,255,255,0.12);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.s-btn-neutral:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.s-btn-red { 
    color: #fff; 
    background: linear-gradient(135deg, rgba(239,68,68,0.9), rgba(220,38,38,0.9)); 
    border-color: rgba(239,68,68,0.4);
    box-shadow: 0 4px 15px rgba(239,68,68,0.3);
}

.s-btn-red:hover {
    background: linear-gradient(135deg, rgba(239,68,68,1), rgba(220,38,38,1));
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(239,68,68,0.5);
}

/* Mobile menu toggle (Off-canvas Button) */
.s-menu-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: 1px solid rgba(59,130,246,0.5);
    color: #fff;
    padding: 10px 18px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    font-family: var(--font-family);
    max-width: 250px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: var(--s-transition);
    box-shadow: 0 4px 15px rgba(59,130,246,0.3);
}

.s-menu-toggle:hover { 
    background: linear-gradient(135deg, #60a5fa, #3b82f6); 
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59,130,246,0.4);
}

.s-menu-toggle:active {
    transform: translateY(0);
}

@media (max-width: 860px) { .s-menu-toggle { display: inline-flex; } }

/* Layout */
.s-layout {
    display: flex;
    gap: var(--s-gap);
    align-items: flex-start;
}
@media (max-width: 860px) { .s-layout { display: block; } }

/* Backdrop */
.s-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1199;
}
.s-backdrop.open { display: block; }

/* Sidebar — Modern Glass Design */
.s-sidebar {
    width: var(--s-sidebar-w);
    flex-shrink: 0;
    background: linear-gradient(180deg, 
        rgba(24,24,27,0.95) 0%, 
        rgba(18,18,21,0.98) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 88px;
    overflow: hidden;
    box-shadow: 
        0 0 0 1px rgba(255,255,255,0.03) inset,
        0 20px 60px rgba(0,0,0,0.4),
        0 0 40px rgba(239,68,68,0.05);
    transition: var(--s-transition);
}

.s-sidebar:hover {
    border-color: rgba(239,68,68,0.15);
    box-shadow: 
        0 0 0 1px rgba(239,68,68,0.1) inset,
        0 25px 70px rgba(0,0,0,0.5),
        0 0 50px rgba(239,68,68,0.08);
}
@media (max-width: 860px) {
    .s-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -295px !important;
        width: 275px !important;
        max-width: 85vw !important;
        height: 100dvh !important;
        z-index: 1200 !important;
        background: #141417 !important;
        border-right: 1px solid rgba(255,255,255,0.1) !important;
        border-radius: 0 16px 16px 0 !important;
        box-shadow: 8px 0 32px rgba(0,0,0,0.9) !important;
        transition: left 0.3s cubic-bezier(0.4,0,0.2,1) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .s-sidebar.open { left: 0 !important; }
}

/* Sidebar drawer header */
.s-drawer-head {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-white-5);
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    background: var(--bg-zinc-900);
    position: sticky;
    top: 0;
    z-index: 1;
}
@media (max-width: 860px) { .s-drawer-head { display: flex; } }

.s-drawer-close {
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border-white-10);
    color: var(--text-zinc-300);
    padding: 5px 11px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-family);
}

.s-nav-inner {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.s-nav-group-label {
    font-size: 10.5px;
    font-weight: 900;
    color: var(--text-zinc-400);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 12px 8px;
    background: linear-gradient(90deg, rgba(239,68,68,0.08), transparent);
    border-left: 3px solid rgba(239,68,68,0.5);
    margin-bottom: 4px;
    border-radius: 0 8px 8px 0;
}

/* Sidebar buttons — Enhanced Design */
.settings-sidebar-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-zinc-400);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--s-transition);
    text-align: left;
    font-family: var(--font-family);
    position: relative;
    overflow: hidden;
}

.settings-sidebar-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 60%;
    background: linear-gradient(90deg, rgba(239,68,68,0.8), transparent);
    transition: width 0.3s ease;
    border-radius: 0 4px 4px 0;
}

.settings-sidebar-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.05), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.settings-sidebar-btn:hover { 
    background: rgba(255,255,255,0.05);
    color: #fff;
    transform: translateX(4px);
}

.settings-sidebar-btn:hover::before {
    width: 4px;
}

.settings-sidebar-btn:hover::after {
    opacity: 1;
}

.settings-sidebar-btn.active {
    background: linear-gradient(135deg, 
        rgba(239,68,68,0.2) 0%, 
        rgba(220,38,38,0.15) 100%);
    color: #fff;
    border-color: rgba(239,68,68,0.3);
    box-shadow: 
        0 0 0 1px rgba(239,68,68,0.2) inset,
        0 8px 24px rgba(239,68,68,0.2);
    transform: translateX(4px);
}

.settings-sidebar-btn.active::before {
    width: 4px;
    background: linear-gradient(90deg, rgba(239,68,68,1), rgba(239,68,68,0.4));
}

.settings-sidebar-btn.active::after {
    opacity: 1;
}

.settings-sidebar-btn.active .sidebar-icon {
    filter: drop-shadow(0 0 6px rgba(239,68,68,0.6));
}

.sidebar-icon { 
    font-size: 18px; 
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.settings-sidebar-btn:hover .sidebar-icon {
    transform: scale(1.1);
}

.settings-sidebar-btn.active .sidebar-icon {
    transform: scale(1.15);
}

/* Main panel */
.s-main { flex: 1; min-width: 0; width: 100%; }

/* Tab panels */
.settings-tab-panel {
    display: none;
    flex-direction: column;
    gap: 18px;
}
.settings-tab-panel.active { display: flex; }

/* Cards — Premium Glass Design */
.s-card {
    background: linear-gradient(135deg, 
        rgba(24,24,27,0.8) 0%, 
        rgba(18,18,21,0.9) 100%);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    padding: var(--s-pad);
    border-radius: var(--s-radius);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 
        0 0 0 1px rgba(255,255,255,0.03) inset,
        0 8px 32px rgba(0,0,0,0.3);
    transition: var(--s-transition);
    position: relative;
    overflow: hidden;
}

.s-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255,255,255,0.15) 50%, 
        transparent 100%);
}

.s-card:hover {
    border-color: rgba(255,255,255,0.1);
    box-shadow: 
        0 0 0 1px rgba(255,255,255,0.05) inset,
        0 12px 48px rgba(0,0,0,0.4);
    transform: translateY(-2px);
}

.s-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255,255,255,0.03) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: inherit;
}

.s-card:hover::after {
    opacity: 1;
}

.s-card-danger { 
    background: linear-gradient(135deg, 
        rgba(239,68,68,0.08) 0%, 
        rgba(220,38,38,0.05) 100%);
    border-color: rgba(239,68,68,0.25);
    box-shadow: 
        0 0 0 1px rgba(239,68,68,0.1) inset,
        0 8px 32px rgba(239,68,68,0.15);
}

.s-card-danger:hover {
    border-color: rgba(239,68,68,0.35);
    box-shadow: 
        0 0 0 1px rgba(239,68,68,0.15) inset,
        0 12px 48px rgba(239,68,68,0.25);
}

.s-card-info { 
    background: linear-gradient(135deg, 
        rgba(59,130,246,0.08) 0%, 
        rgba(37,99,235,0.05) 100%);
    border-color: rgba(59,130,246,0.25);
    box-shadow: 
        0 0 0 1px rgba(59,130,246,0.1) inset,
        0 8px 32px rgba(59,130,246,0.15);
}

.s-card-info:hover {
    border-color: rgba(59,130,246,0.35);
    box-shadow: 
        0 0 0 1px rgba(59,130,246,0.15) inset,
        0 12px 48px rgba(59,130,246,0.25);
}

@media (max-width: 400px) { 
    .s-card { 
        padding: 16px; 
        border-radius: 16px; 
    } 
}

.s-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: relative;
}

.s-card-head::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 45px;
    height: 2px;
    background: linear-gradient(90deg, rgba(239,68,68,0.9), transparent);
    border-radius: 2px;
}

.s-card-title {
    font-size: 16px;
    font-weight: 900;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.s-card-danger .s-card-head::after {
    background: linear-gradient(90deg, rgba(239,68,68,1), transparent);
}

.s-card-info .s-card-head::after {
    background: linear-gradient(90deg, rgba(59,130,246,1), transparent);
}

/* Form */
.s-field { margin-bottom: 15px; }
.s-field:last-child { margin-bottom: 0; }
.s-label { display: block; font-size: 12.5px; font-weight: 700; color: #fff; margin-bottom: 7px; }
.s-label-sub { font-size: 11px; color: var(--text-zinc-500); font-weight: 400; margin-left: 4px; }

.s-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(9,9,11,0.8);
    color: #fff;
    font-size: 14px;
    outline: none;
    font-family: var(--font-family);
    box-sizing: border-box;
    transition: var(--s-transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) inset;
    position: relative;
}

.s-input::placeholder {
    color: var(--text-zinc-500);
    transition: color 0.3s ease;
}

.s-input:hover {
    border-color: rgba(255,255,255,0.15);
    background: rgba(9,9,11,0.9);
}

.s-input:hover::placeholder {
    color: var(--text-zinc-400);
}

.s-input:focus { 
    border-color: rgba(239,68,68,0.6); 
    background: rgba(9,9,11,1);
    box-shadow: 
        0 0 0 4px rgba(239,68,68,0.1),
        0 2px 8px rgba(0,0,0,0.15) inset;
}
.s-input-mono  { font-family: 'Courier New', monospace; }
.s-input-green { border-color: rgba(52,211,153,0.35); }
.s-input-green:focus { border-color: rgba(52,211,153,0.65); }

/* 2-col grid */
.s-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 580px) { .s-grid-2 { grid-template-columns: 1fr; } }

/* Stats grids — Enhanced Design */
.s-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}
@media (max-width: 400px) { .s-stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; } }

.s-stat {
    background: linear-gradient(135deg, 
        rgba(255,255,255,0.04) 0%, 
        rgba(255,255,255,0.02) 100%);
    backdrop-filter: blur(8px);
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 
        0 0 0 1px rgba(255,255,255,0.03) inset,
        0 4px 20px rgba(0,0,0,0.15);
    transition: var(--s-transition);
    position: relative;
    overflow: hidden;
}

.s-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(239,68,68,0.6) 50%, 
        transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.s-stat::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255,255,255,0.04) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.s-stat:hover {
    transform: translateY(-3px);
    border-color: rgba(255,255,255,0.12);
    box-shadow: 
        0 0 0 1px rgba(255,255,255,0.05) inset,
        0 8px 30px rgba(0,0,0,0.25);
}

.s-stat:hover::before {
    opacity: 1;
}

.s-stat:hover::after {
    opacity: 1;
}

.s-stat-label { 
    font-size: 11px; 
    color: var(--text-zinc-400); 
    font-weight: 800; 
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.s-stat-val { 
    font-size: 20px; 
    font-weight: 900;
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: transform 0.3s ease;
}

.s-stat:hover .s-stat-val {
    transform: scale(1.05);
}

/* Visitor stats */
.s-visitor-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

/* API key row */
.s-key-row { display: flex; gap: 8px; margin-bottom: 6px; align-items: center; }
.s-key-row input { flex: 1; min-width: 0; }
.s-key-del {
    padding: 10px 12px;
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.3);
    color: #f87171;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 14px;
    font-family: var(--font-family);
    transition: background 0.2s ease;
}
.s-key-del:hover { background: rgba(239,68,68,0.22); }

/* Buttons — Premium Design */
.s-btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.s-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-family);
    transition: var(--s-transition);
    white-space: nowrap;
    background: none;
    position: relative;
    overflow: hidden;
}

.s-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.s-btn:hover::before {
    opacity: 1;
}

.s-btn-primary { 
    background: linear-gradient(135deg, rgba(239,68,68,0.95), rgba(220,38,38,0.95)); 
    color: #fff; 
    border-color: rgba(239,68,68,0.4); 
    box-shadow: 
        0 0 0 1px rgba(239,68,68,0.2) inset,
        0 6px 20px rgba(239,68,68,0.35); 
}

.s-btn-primary:hover {
    background: linear-gradient(135deg, rgba(239,68,68,1), rgba(220,38,38,1));
    transform: translateY(-2px);
    box-shadow: 
        0 0 0 1px rgba(239,68,68,0.3) inset,
        0 8px 28px rgba(239,68,68,0.5);
}

.s-btn-ghost { 
    color: var(--text-zinc-300); 
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.s-btn-ghost:hover { 
    background: rgba(255,255,255,0.08); 
    color: #fff;
    border-color: rgba(255,255,255,0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.s-btn-green { 
    background: rgba(52,211,153,0.12); 
    color: #34d399; 
    border-color: rgba(52,211,153,0.35);
    box-shadow: 0 4px 15px rgba(52,211,153,0.15);
}

.s-btn-green:hover {
    background: rgba(52,211,153,0.18);
    border-color: rgba(52,211,153,0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(52,211,153,0.25);
}

/* Platform checkboxes — Premium Design */
.s-platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
@media (max-width: 540px) { .s-platform-grid { grid-template-columns: 1fr; gap: 10px; } }

.s-platform-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(135deg, 
        rgba(255,255,255,0.03) 0%, 
        rgba(255,255,255,0.01) 100%);
    cursor: pointer;
    transition: var(--s-transition);
    user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    width: 100%;
}

.s-platform-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(239,68,68,0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.s-platform-item:hover { 
    border-color: rgba(255,255,255,0.15); 
    background: linear-gradient(135deg, 
        rgba(255,255,255,0.06) 0%, 
        rgba(255,255,255,0.03) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.s-platform-item:hover::before {
    opacity: 1;
}

.s-platform-item input[type="checkbox"] { 
    width: 18px; 
    height: 18px; 
    flex-shrink: 0; 
    accent-color: var(--red-500);
    cursor: pointer;
}

.s-platform-name { 
    font-size: 13.5px; 
    font-weight: 800; 
    color: var(--text-zinc-300); 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}

.s-platform-item:hover .s-platform-name {
    color: #fff;
}

/* Sticky Save Action Bar */
.s-sticky-save-bar {
    position: sticky;
    bottom: 20px;
    z-index: 100;
    margin-top: 24px;
    padding: 14px 20px;
    background: rgba(18, 18, 21, 0.88);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 18px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(239, 68, 68, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.s-sticky-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #e4e4e7;
}

.s-sticky-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 10px #4ade80;
    animation: sPulseDot 2s infinite;
}

@keyframes sPulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

@media (max-width: 600px) {
    .s-sticky-save-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 12px 14px !important;
        bottom: 10px !important;
        gap: 10px !important;
        margin-top: 16px !important;
    }

    .s-sticky-save-bar > div:last-child {
        display: flex !important;
        width: 100% !important;
        gap: 8px !important;
    }

    .s-sticky-save-bar > div:last-child > button {
        flex: 1 !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 10px 12px !important;
        font-size: 12.5px !important;
    }

    .s-sticky-info {
        font-size: 12px !important;
        justify-content: center !important;
    }
}

/* Cache buttons */
.s-cache-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
    gap: 10px;
}
@media (max-width: 400px) { .s-cache-grid { grid-template-columns: 1fr; } }

.s-cache-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px 15px;
    border-radius: 13px;
    border: 1px solid;
    background: rgba(255,255,255,0.025);
    color: #fff;
    cursor: pointer;
    font-family: var(--font-family);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
    width: 100%;
}
.s-cache-btn:hover { transform: translateY(-2px); }
.s-cache-btn-title { font-size: 13px; font-weight: 800; }
.s-cache-btn-desc  { font-size: 11px; color: var(--text-zinc-500); }

/* Visitor table */
.s-table-wrap {
    overflow-x: auto;
    background: var(--bg-zinc-900);
    border-radius: 12px;
    border: 1px solid var(--border-white-5);
    -webkit-overflow-scrolling: touch;
}
.s-table { width: 100%; border-collapse: collapse; font-size: 11.5px; min-width: 640px; }
.s-table th { padding: 8px 11px; text-align: left; color: var(--text-zinc-400); font-weight: 800; border-bottom: 1px solid rgba(255,255,255,0.07); white-space: nowrap; }
.s-table td { padding: 7px 11px; color: var(--text-zinc-300); border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }

/* Security log */
.s-sec-log { max-height: 200px; overflow-y: auto; background: var(--bg-zinc-900); border-radius: 11px; border: 1px solid var(--border-white-5); }
.s-sec-log-item { padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 11.5px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }

/* Save bar — Premium Design */
.s-save-bar { 
    position: sticky; 
    bottom: 80px; 
    z-index: 50; 
    padding: 20px 0 0;
    margin-top: 24px;
}

.s-save-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, 
        rgba(239,68,68,0.95) 0%, 
        rgba(220,38,38,0.95) 100%);
    color: #fff;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    font-family: var(--font-family);
    box-shadow: 
        0 0 0 1px rgba(239,68,68,0.3) inset,
        0 10px 35px rgba(239,68,68,0.45),
        0 0 60px rgba(239,68,68,0.2);
    transition: var(--s-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.s-save-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.s-save-btn:hover::before {
    opacity: 1;
}

.s-save-btn:hover { 
    transform: translateY(-3px) scale(1.01); 
    background: linear-gradient(135deg, 
        rgba(239,68,68,1) 0%, 
        rgba(220,38,38,1) 100%);
    box-shadow: 
        0 0 0 1px rgba(239,68,68,0.4) inset,
        0 15px 50px rgba(239,68,68,0.6),
        0 0 80px rgba(239,68,68,0.3);
}

.s-save-btn:active {
    transform: translateY(-1px) scale(0.99);
}

/* Backup pair card */
.backup-pair-row {
    background: rgba(0,0,0,0.3);
    padding: 16px;
    border-radius: 13px;
    border: 1px solid rgba(52,211,153,0.25);
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 10px;
}
.backup-pair-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }

/* SweetAlert2 override */
.swal2-popup { background: #18181b !important; border: 1px solid rgba(255,255,255,0.1) !important; border-radius: 18px !important; font-family: var(--font-family) !important; color: #e4e4e7 !important; max-width: min(480px, 92vw) !important; }
.swal2-title { color: #fff !important; font-size: clamp(15px, 3vw, 18px) !important; }
.swal2-html-container { color: #a1a1aa !important; font-size: 13px !important; }
.swal2-confirm { background: linear-gradient(135deg,#ef4444,#dc2626) !important; border-radius: 10px !important; font-weight: 700 !important; }
.swal2-cancel { background: rgba(255,255,255,0.08) !important; color: #e4e4e7 !important; border-radius: 10px !important; font-weight: 700 !important; }
.swal2-icon.swal2-success { border-color: #22c55e !important; }
.swal2-icon.swal2-success [class^='swal2-success-line'] { background: #22c55e !important; }
.swal2-icon.swal2-success .swal2-success-ring { border-color: rgba(34,197,94,0.3) !important; }
.swal2-icon.swal2-error { border-color: #ef4444 !important; }
.swal2-icon.swal2-error [class^='swal2-x-mark-line'] { background-color: #ef4444 !important; }
.swal2-icon.swal2-warning { border-color: #f59e0b !important; color: #f59e0b !important; }
.swal2-timer-progress-bar { background: var(--red-500) !important; }

/* Login form */
.s-login-form { display: flex; flex-direction: column; gap: 16px; max-width: 420px; margin: 40px auto; padding: 0 4px; }
.s-login-icon { font-size: 48px; text-align: center; margin-bottom: 4px; }
.s-login-title { color: #fff; font-size: 18px; font-weight: 800; text-align: center; margin-bottom: 5px; }
.s-login-sub   { font-size: 13px; color: var(--text-zinc-400); text-align: center; }

/* =====================================================
   RESPONSIVE OVERRIDES for remaining inline-styled
   tab content (TAB 2-6). These rules fix layout on
   mobile without touching each inline style.
   ===================================================== */

/* Fix all card-like containers inside tabs */
.settings-tab-panel > div,
.settings-tab-panel > div > div {
    box-sizing: border-box;
    max-width: 100%;
}

/* Fix grid layouts inside tabs on small screens */
@media (max-width: 600px) {
    /* Primary/Backup API grid */
    .settings-tab-panel div[style*="grid-template-columns: repeat(auto-fit, minmax(260px"],
    .settings-tab-panel div[style*="grid-template-columns: repeat(auto-fit, minmax(280px"],
    .settings-tab-panel div[style*="grid-template-columns: repeat(auto-fit, minmax(240px"],
    .settings-tab-panel div[style*="grid-template-columns: repeat(auto-fit, minmax(140px"],
    .settings-tab-panel div[style*="grid-template-columns: repeat(auto-fill, minmax(240px"] {
        grid-template-columns: 1fr !important;
    }
}

/* Force all inputs/textareas inside tabs to be full width */
.settings-tab-panel input[type="text"],
.settings-tab-panel input[type="url"],
.settings-tab-panel input[type="number"],
.settings-tab-panel input[type="password"],
.settings-tab-panel textarea,
.settings-tab-panel select {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    font-size: 14px !important;
}

/* Fix API key row on mobile */
.api-key-container > div {
    flex-wrap: nowrap !important;
    gap: 7px !important;
}

.api-key-container input {
    min-width: 0 !important;
}

/* Fix card headers that use flex */
@media (max-width: 520px) {
    .settings-tab-panel div[style*="justify-content: space-between"][style*="flex-wrap: wrap"],
    .settings-tab-panel div[style*="justify-content: space-between; align-items: center"] {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
}

/* Platform grid on mobile */
@media (max-width: 480px) {
    .settings-tab-panel div[style*="grid-template-columns: repeat(auto-fill, minmax(240px"] {
        grid-template-columns: 1fr !important;
        max-height: 360px !important;
    }
}

/* Theme color grid */
@media (max-width: 400px) {
    .settings-tab-panel div[style*="grid-template-columns: repeat(auto-fit, minmax(140px"] {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* Cache buttons grid */
@media (max-width: 480px) {
    .settings-tab-panel div[style*="minmax(200px"] {
        grid-template-columns: 1fr !important;
    }
}

/* Fix backup pair row grid */
.backup-pair-row div[style*="grid-template-columns"] {
    box-sizing: border-box;
}

@media (max-width: 580px) {
    .backup-pair-row div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* Fix card padding on very small screens */
@media (max-width: 400px) {
    .settings-tab-panel > div[style*="padding: 20px"],
    .settings-tab-panel > div[style*="padding: 22px"] {
        padding: 13px !important;
        border-radius: 13px !important;
    }
}

/* Fix button rows to wrap properly */
.settings-tab-panel div[style*="display: flex"][style*="gap: 8px"],
.settings-tab-panel div[style*="display: flex"][style*="gap: 6px"] {
    flex-wrap: wrap;
}

/* Form labels full width */
.settings-tab-panel label[style*="display: block"] {
    display: block !important;
    width: 100% !important;
}

/* Save bar sticky fix */
.s-save-bar button[name="save_settings"],
.s-save-bar input[name="save_settings"],
.s-save-bar button[type="submit"] {
    width: 100% !important;
    border-radius: 14px !important;
    padding: 14px !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    background: var(--red-gradient) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 8px 24px rgba(239,68,68,0.4) !important;
    cursor: pointer !important;
    font-family: var(--font-family) !important;
}

/* Fix header action buttons on very small screens */
@media (max-width: 380px) {
    .s-header-actions { gap: 5px; }
    .s-header-btn { padding: 5px 9px; font-size: 11px; }
    .s-menu-toggle { max-width: 150px; padding: 6px 10px; font-size: 11.5px; }
}

/* Ensure main panel doesn't overflow */
.s-main { overflow-x: hidden; }

/* =====================================================
   MOBILE OPTIMIZATIONS (< 480px)
   ===================================================== */

@media (max-width: 480px) {
    /* Tighter spacing on mobile */
    :root {
        --s-gap: 16px;
        --s-radius: 16px;
        --s-pad: 16px;
    }

    /* Header adjustments */
    .s-header {
        padding: 14px 16px;
        margin-bottom: 20px;
        border-radius: 16px;
    }

    .s-header-title {
        font-size: 20px;
    }

    .s-header-btn {
        padding: 7px 12px;
        font-size: 12px;
    }

    /* Card adjustments */
    .s-card {
        padding: 16px;
        border-radius: 16px;
    }

    .s-card-head {
        margin-bottom: 16px;
        padding-bottom: 14px;
    }

    .s-card-title {
        font-size: 14px;
    }

    /* Stats grid - force 2 columns on small phones */
    .s-stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
    }

    .s-stat {
        padding: 12px 14px;
    }

    .s-stat-label {
        font-size: 10px;
    }

    .s-stat-val {
        font-size: 16px;
    }

    /* Input fields */
    .s-input {
        padding: 10px 14px;
        font-size: 13px;
    }

    /* Buttons */
    .s-btn {
        padding: 9px 14px;
        font-size: 12.5px;
    }

    /* Platform grid */
    .s-platform-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .s-platform-item {
        padding: 10px 12px;
    }

    /* Save button */
    .s-save-btn {
        padding: 14px 20px;
        font-size: 15px;
    }

    /* Sidebar buttons on mobile */
    .settings-sidebar-btn {
        padding: 10px 12px;
        font-size: 13px;
    }

    .sidebar-icon {
        font-size: 16px;
    }

    /* Table responsive */
    .s-table {
        font-size: 11px;
    }

    .s-table th,
    .s-table td {
        padding: 6px 8px;
    }
}

/* =====================================================
   EXTRA SMALL MOBILE (< 360px)
   ===================================================== */

@media (max-width: 360px) {
    /* Ultra compact mode */
    .s-wrap {
        padding: 10px;
        margin: 6px;
    }

    .s-header {
        padding: 12px 14px;
        margin-bottom: 16px;
    }

    .s-header-title {
        font-size: 18px;
        gap: 8px;
    }

    .s-card {
        padding: 14px;
    }

    .s-card-title {
        font-size: 13px;
    }

    .s-stats-grid {
        gap: 8px;
    }

    .s-stat {
        padding: 10px 12px;
    }

    .s-stat-val {
        font-size: 15px;
    }

    .s-input {
        padding: 9px 12px;
        font-size: 12.5px;
    }

    .s-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .s-save-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    /* Make header action buttons icon-only on very small screens */
    .s-header-btn span:not(:first-child) {
        display: none;
    }

    .s-header-btn {
        padding: 7px;
        min-width: 36px;
        justify-content: center;
    }
}

/* =====================================================
   LANDSCAPE MOBILE FIXES
   ===================================================== */

@media (max-height: 600px) and (orientation: landscape) {
    .s-sidebar {
        height: 100vh !important;
    }

    .s-save-bar {
        position: relative;
        bottom: auto;
    }
}

/* =====================================================
   TOUCH DEVICE OPTIMIZATIONS
   ===================================================== */

@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .s-card:hover,
    .s-stat:hover,
    .s-platform-item:hover {
        transform: none;
    }

    /* Larger tap targets */
    .s-header-btn,
    .s-btn,
    .settings-sidebar-btn {
        min-height: 44px;
    }

    .s-platform-item input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    /* Disable complex hover states */
    .s-btn:hover::before,
    .s-card:hover::before,
    .s-stat:hover::before {
        opacity: 0;
    }
}
