.tabler-device-mobile {
    --svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2zm6 13h.01'/%3E%3C/svg%3E");
}
.tabler-wifi-off {
    --svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 20h.01M2 8.82a15 15 0 0 1 4.17-2.65M5 12.859a10 10 0 0 1 5.17-2.69M10.71 5.05A16 16 0 0 1 22.56 9M1.42 9a16 16 0 0 1 1.74-1.45M8.53 16.11a6 6 0 0 1 6.95 0M3 3l18 18'/%3E%3C/svg%3E");
}

.pwa-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

#iconPreviewWrap { display: flex; justify-content: center; }
.form-control-color { padding: .375rem; cursor: pointer; }
.list-group-item .badge { font-size: .75rem; }

/* ==========================================================================
   PWA Install Banner & Preview - Light / Dark Mode & Responsive System
   ========================================================================== */

:root {
    --pwa-bg: rgba(255, 255, 255, 0.98);
    --pwa-border: rgba(226, 232, 240, 0.95);
    --pwa-text: #1e293b;
    --pwa-muted: #64748b;
    --pwa-shadow: 0 14px 34px rgba(15, 23, 42, 0.16), 0 3px 8px rgba(15, 23, 42, 0.08);
    --pwa-btn-sec-bg: #f1f5f9;
    --pwa-btn-sec-text: #475569;
    --pwa-btn-sec-border: #e2e8f0;
    --pwa-btn-sec-hover: #e2e8f0;
    --pwa-icon-bg: #f8fafc;
    --pwa-badge-bg: rgba(40, 199, 111, 0.12);
    --pwa-badge-color: #28c76f;
    --pwa-badge-border: rgba(40, 199, 111, 0.25);
}

html[data-bs-theme="dark"],
[data-bs-theme="dark"],
.dark-style,
.pwa-force-dark {
    --pwa-bg: rgba(47, 51, 73, 0.98);
    --pwa-border: rgba(255, 255, 255, 0.12);
    --pwa-text: #e6e9f8;
    --pwa-muted: #8e95b2;
    --pwa-shadow: 0 18px 42px rgba(0, 0, 0, 0.55), 0 4px 14px rgba(0, 0, 0, 0.35);
    --pwa-btn-sec-bg: rgba(255, 255, 255, 0.08);
    --pwa-btn-sec-text: #cfd3ec;
    --pwa-btn-sec-border: rgba(255, 255, 255, 0.14);
    --pwa-btn-sec-hover: rgba(255, 255, 255, 0.15);
    --pwa-icon-bg: rgba(255, 255, 255, 0.06);
    --pwa-badge-bg: rgba(40, 199, 111, 0.2);
    --pwa-badge-color: #48da89;
    --pwa-badge-border: rgba(40, 199, 111, 0.35);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-bs-theme="light"]):not(.light-style) {
        --pwa-bg: rgba(47, 51, 73, 0.98);
        --pwa-border: rgba(255, 255, 255, 0.12);
        --pwa-text: #e6e9f8;
        --pwa-muted: #8e95b2;
        --pwa-shadow: 0 18px 42px rgba(0, 0, 0, 0.55), 0 4px 14px rgba(0, 0, 0, 0.35);
        --pwa-btn-sec-bg: rgba(255, 255, 255, 0.08);
        --pwa-btn-sec-text: #cfd3ec;
        --pwa-btn-sec-border: rgba(255, 255, 255, 0.14);
        --pwa-btn-sec-hover: rgba(255, 255, 255, 0.15);
        --pwa-icon-bg: rgba(255, 255, 255, 0.06);
        --pwa-badge-bg: rgba(40, 199, 111, 0.2);
        --pwa-badge-color: #48da89;
        --pwa-badge-border: rgba(40, 199, 111, 0.35);
    }
}

.pwa-force-light {
    --pwa-bg: rgba(255, 255, 255, 0.98) !important;
    --pwa-border: rgba(226, 232, 240, 0.95) !important;
    --pwa-text: #1e293b !important;
    --pwa-muted: #64748b !important;
    --pwa-shadow: 0 14px 34px rgba(15, 23, 42, 0.16), 0 3px 8px rgba(15, 23, 42, 0.08) !important;
    --pwa-btn-sec-bg: #f1f5f9 !important;
    --pwa-btn-sec-text: #475569 !important;
    --pwa-btn-sec-border: #e2e8f0 !important;
    --pwa-btn-sec-hover: #e2e8f0 !important;
    --pwa-icon-bg: #f8fafc !important;
    --pwa-badge-bg: rgba(40, 199, 111, 0.12) !important;
    --pwa-badge-color: #28c76f !important;
    --pwa-badge-border: rgba(40, 199, 111, 0.25) !important;
}

/* ==========================================================================
   Install banner — premium card (shared by the live banner + admin preview)
   ========================================================================== */

/* Floating Banner Container (Production Injected) */
.pwa-banner-fixed {
    position: fixed;
    bottom: max(18px, env(safe-area-inset-bottom, 18px));
    left: 50%;
    transform: translateX(-50%) translateY(130%) scale(.97);
    z-index: 99999;
    width: calc(100% - 28px);
    max-width: 430px;
    opacity: 0;
    pointer-events: none;
    transition: transform .46s cubic-bezier(.16, 1, .3, 1), opacity .3s ease;
}

.pwa-banner-fixed.pwa-show {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Card shell: glass, hairline gradient border, layered depth */
.pwa-banner-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    color: var(--pwa-text);
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(105, 108, 255, .14), transparent 58%),
        var(--pwa-bg);
    border: 1px solid transparent;
    border-radius: 22px;
    padding: 16px 16px 15px;
    box-shadow:
        var(--pwa-shadow),
        0 0 0 1px rgba(255, 255, 255, .16) inset,
        0 1px 0 rgba(255, 255, 255, .5) inset;
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    transition: background-color .25s ease, color .25s ease, box-shadow .25s ease, transform .25s ease;
    font-family: inherit;
    box-sizing: border-box;
}

/* Gradient hairline that survives any theme */
.pwa-banner-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(150deg,
        rgba(255, 255, 255, .9),
        rgba(105, 108, 255, .55) 30%,
        rgba(22, 213, 200, .35) 62%,
        rgba(255, 255, 255, .25));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask-composite: exclude;
    pointer-events: none;
    opacity: .75;
    z-index: 2;
}

/* Soft top glow */
.pwa-banner-card::after {
    content: "";
    position: absolute;
    left: -10%;
    right: -10%;
    top: -70%;
    height: 130%;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(105, 108, 255, .22), transparent 72%);
    pointer-events: none;
    z-index: 0;
}

html[data-bs-theme="dark"] .pwa-banner-card,
[data-bs-theme="dark"] .pwa-banner-card,
.dark-style .pwa-banner-card,
.pwa-force-dark .pwa-banner-card {
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(105, 108, 255, .3), transparent 60%),
        var(--pwa-bg);
    box-shadow:
        var(--pwa-shadow),
        0 0 0 1px rgba(255, 255, 255, .08) inset,
        0 1px 0 rgba(255, 255, 255, .12) inset;
}

/* ---- header ---- */
.pwa-banner-info-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 14px;
}

.pwa-banner-icon {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 15px;
    background: var(--pwa-icon-bg);
    border: 1px solid var(--pwa-border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow:
        0 6px 16px -8px rgba(15, 23, 42, .55),
        0 0 0 1px rgba(255, 255, 255, .35) inset;
}

.pwa-banner-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pwa-banner-icon i {
    font-size: 24px;
    color: var(--pwa-muted);
}

.pwa-banner-meta {
    flex: 1;
    min-width: 0;
}

.pwa-banner-name-row {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: nowrap;
    margin-bottom: 3px;
}

.pwa-banner-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.012em;
    color: var(--pwa-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.24;
}

.pwa-banner-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px 2px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    line-height: 1.5;
    background: var(--pwa-badge-bg);
    color: var(--pwa-badge-color);
    border: 1px solid var(--pwa-badge-border);
    flex-shrink: 0;
}

.pwa-banner-subtitle {
    font-size: 12px;
    font-weight: 500;
    color: var(--pwa-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
}

/* ---- actions ---- */
.pwa-banner-actions {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 9px;
    width: 100%;
}

.pwa-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 16px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 650;
    letter-spacing: -.01em;
    border-radius: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: transform .16s ease, box-shadow .2s ease, background-color .2s ease, filter .2s ease;
    border: 1px solid transparent;
    flex: 1;
    min-height: 44px;
    white-space: nowrap;
    outline: none;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.pwa-action-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(105, 108, 255, .38);
}

.pwa-action-btn:active {
    transform: scale(.975);
}

.pwa-action-btn-primary {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, .22);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, 0) 62%);
    box-shadow:
        0 10px 22px -12px rgba(105, 108, 255, .95),
        0 1px 0 rgba(255, 255, 255, .4) inset;
}

.pwa-action-btn-primary:hover {
    filter: brightness(1.06) saturate(1.05);
    box-shadow:
        0 14px 26px -12px rgba(105, 108, 255, 1),
        0 1px 0 rgba(255, 255, 255, .45) inset;
}

.pwa-action-btn-primary svg {
    opacity: .95;
}

.pwa-action-btn-secondary {
    background: var(--pwa-btn-sec-bg) !important;
    color: var(--pwa-btn-sec-text) !important;
    border-color: var(--pwa-btn-sec-border) !important;
    font-weight: 600;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;
}

.pwa-action-btn-secondary:hover {
    background: var(--pwa-btn-sec-hover) !important;
}

/* ---- small screens ---- */
@media (max-width: 420px) {
    .pwa-banner-fixed {
        width: calc(100% - 20px);
        bottom: max(12px, env(safe-area-inset-bottom, 12px));
    }

    .pwa-banner-card {
        border-radius: 20px;
        padding: 14px 14px 13px;
    }

    .pwa-banner-icon {
        width: 46px;
        height: 46px;
        border-radius: 13px;
    }

    .pwa-banner-title {
        font-size: 14px;
    }

    .pwa-banner-subtitle {
        font-size: 11.5px;
    }

    .pwa-action-btn {
        min-height: 42px;
        font-size: 13px;
        padding: 0 12px;
        border-radius: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pwa-banner-fixed,
    .pwa-action-btn {
        transition: none !important;
    }
}

/* iOS install guidance sheet */
.pwa-ios-modal {
    position: fixed;
    inset: 0;
    background: rgba(6, 5, 20, .62);
    z-index: 100000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn .2s ease;
}

.pwa-ios-sheet {
    background: var(--pwa-bg);
    color: var(--pwa-text);
    border-radius: 22px;
    border: 1px solid var(--pwa-border);
    box-shadow: var(--pwa-shadow);
    padding: 22px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    animation: slideUp .3s cubic-bezier(.16, 1, .3, 1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
