@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

* {
    margin: 0; padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

:root {
    --bg:          #06070d;
    --bg-card:     #0e1018;
    --bg-sheet:    #0c0d14;
    --bg-input:    #090a12;
    --bg-row:      #12141d80;

    /* ── Primary: Electric Violet-Blue ── */
    --accent:      #7c5cfc;
    --accent-2:    #a78bfa;
    --accent-dim:  rgba(124, 92, 252, 0.10);
    --accent-glow: rgba(124, 92, 252, 0.22);

    /* ── Secondary: Cyan ── */
    --teal:        #22d3ee;
    --teal-dim:    rgba(34, 211, 238, 0.08);
    --teal-glow:   rgba(34, 211, 238, 0.18);

    /* ── Tertiary: Pink/Magenta ── */
    --purple:      #e879f9;
    --purple-dim:  rgba(232, 121, 249, 0.10);

    /* ── Danger ── */
    --red:         #f43f5e;
    --red-dim:     rgba(244, 63, 94, 0.10);
    --red-glow:    rgba(244, 63, 94, 0.22);

    /* ── Success ── */
    --green:       #34d399;
    --green-dim:   rgba(52, 211, 153, 0.10);

    --text:        #eef0f6;
    --text-2:      #5b6080;
    --text-3:      #272b42;

    --border:      rgba(255,255,255,0.05);
    --border-hi:   rgba(124,92,252,0.30);
    --divider:     rgba(255,255,255,0.035);

    --glass:       rgba(14, 16, 24, 0.65);
    --glass-border: rgba(255,255,255,0.06);

    --r-xs: 10px;
    --r-sm: 14px;
    --r:    20px;
    --r-lg: 26px;
    --r-xl: 32px;

    --font-h: 'Space Grotesk', sans-serif;
    --font-b: 'Manrope', sans-serif;

    --status-h:    44px;
    --topbar-h:    58px;
    --bottomnav-h: 62px;
    --safe:        16px;
}

/* =====================================================
   LIGHT THEME OVERRIDES
   ===================================================== */
html.light, .light :root {
    --bg:          #f4f6fa;
    --bg-card:     #ffffff;
    --bg-sheet:    #f9fafc;
    --bg-input:    #edf0f6;
    --bg-row:      #e2e7f380;

    --accent-2:    #4f46e5;
    --accent-dim:  rgba(124, 92, 252, 0.08);
    --accent-glow: rgba(124, 92, 252, 0.15);

    --teal:        #0891b2;
    --teal-dim:    rgba(8, 145, 178, 0.08);
    --teal-glow:   rgba(8, 145, 178, 0.16);

    --purple-dim:  rgba(232, 121, 249, 0.08);

    --red-dim:     rgba(244, 63, 94, 0.08);
    --red-glow:    rgba(244, 63, 94, 0.15);

    --green-dim:   rgba(52, 211, 153, 0.08);

    --text:        #181c30;
    --text-2:      #5b6285;
    --text-3:      #8b94bd;

    --border:      rgba(0, 0, 0, 0.06);
    --divider:     rgba(0, 0, 0, 0.04);

    --glass:       rgba(255, 255, 255, 0.82);
    --glass-border: rgba(0, 0, 0, 0.05);
}

@media (min-width: 431px) {
    html.light body {
        background: #e9ecf3;
        background-image:
            radial-gradient(ellipse at 20% 10%, rgba(124,92,252,0.08) 0%, transparent 50%),
            radial-gradient(ellipse at 80% 90%, rgba(34,211,238,0.06) 0%, transparent 50%);
    }
}

html, body { height: 100%; overflow: hidden; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-b);
    font-size: 14px;
    line-height: 1.55;
    display: flex;
    flex-direction: column;
}

/* =====================================================
   PHONE SHELL
===================================================== */
#phoneShell {
    width: 100%;
    max-width: 430px;
    height: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 100px rgba(0,0,0,0.95);
}

/* ---- STATUS BAR ---- */
#statusBar {
    flex-shrink: 0;
    height: var(--status-h);
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    z-index: 200;
}
.sb-time {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    font-family: var(--font-h);
    letter-spacing: 0.5px;
}
.sb-icons {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-2);
}
.sb-signal {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 13px;
}
.sb-signal span {
    width: 3px;
    border-radius: 1.5px;
    background: var(--accent);
}
.sb-signal span:nth-child(1) { height: 4px; }
.sb-signal span:nth-child(2) { height: 7px; }
.sb-signal span:nth-child(3) { height: 10px; }
.sb-signal span:nth-child(4) { height: 13px; opacity:0.25; }
.sb-batt {
    display: flex;
    align-items: center;
}
.sb-batt-body {
    width: 19px; height: 10px;
    border: 1.5px solid var(--text-2);
    border-radius: 2.5px;
    padding: 1.5px;
}
.sb-batt-fill {
    height: 100%;
    width: 70%;
    border-radius: 1px;
    background: var(--teal);
}
.sb-batt-tip {
    width: 2px; height: 5px;
    background: var(--text-2);
    border-radius: 0 1.5px 1.5px 0;
    margin-left: 1px;
}
.sb-wifi {
    color: var(--text-2);
    flex-shrink: 0;
}

/* ── SVG icon alignment ── */
.tb-btn svg, .btn-main svg, .btn svg, .mh-icon svg,
.nav-tab .ni svg { display: block; flex-shrink: 0; }
.btn-main svg, .btn svg { display: inline-block; vertical-align: -2px; }
.nav-tab .ni { display: flex; align-items: center; justify-content: center; }
.nav-tab .ni svg { stroke: var(--text-2); transition: stroke 0.25s, filter 0.25s; }
.nav-tab.active .ni svg { stroke: var(--accent-2); filter: drop-shadow(0 0 6px var(--accent)); }

/* ---- TOP APP BAR ---- */
#topBar {
    flex-shrink: 0;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 10px;
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 100;
    position: relative;
}
#topBar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--teal), transparent);
    opacity: 0.3;
}

.topbar-logo {
    width: 38px; height: 38px;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--accent) 0%, #4f46e5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 18px var(--accent-glow);
    flex-shrink: 0;
}
.topbar-info { flex: 1; min-width: 0; }
.topbar-title {
    font-family: var(--font-h);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.1;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 40%, var(--teal) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.topbar-sub {
    font-size: 11px;
    color: var(--text-2);
    font-weight: 400;
    letter-spacing: 0.2px;
}
.topbar-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}
.tb-btn {
    width: 36px; height: 36px;
    border-radius: 11px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.22s ease;
    position: relative;
}
.tb-btn:active { transform: scale(0.88); }
.tb-btn:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 12px var(--accent-dim); }
.tb-btn.notif::after {
    content: '';
    position: absolute;
    top: 6px; right: 6px;
    width: 7px; height: 7px;
    background: var(--red);
    border-radius: 50%;
    border: 1.5px solid var(--bg-card);
}

/* =====================================================
   SCROLLABLE CONTENT
===================================================== */
#appContent {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: calc(var(--bottomnav-h) + var(--safe) + 12px);
}
#appContent::-webkit-scrollbar { display: none; }

/* =====================================================
   BOTTOM NAV
===================================================== */
#bottomNav {
    flex-shrink: 0;
    height: calc(var(--bottomnav-h) + var(--safe));
    padding: 8px 8px var(--safe);
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: flex-start;
    justify-content: space-around;
    z-index: 100;
}
.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 18px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}
.nav-tab:active { transform: scale(0.9); }
.nav-tab.active { background: var(--accent-dim); }
.nav-tab .ni { font-size: 21px; line-height: 1; }
.nav-tab .nl {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-2);
    letter-spacing: 0.2px;
    transition: color 0.25s;
}
.nav-tab.active .nl { color: var(--accent-2); }
.nav-tab.active .ni { filter: drop-shadow(0 0 6px var(--accent)); }
.nav-dot {
    display: none;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 1px;
    box-shadow: 0 0 8px var(--accent);
}
.nav-tab.active .nav-dot { display: block; }

/* =====================================================
   PAGE LAYOUT
===================================================== */
.page { padding: 14px 14px 0; }

/* ---- HERO CARD ---- */
.hero-card {
    background: linear-gradient(135deg, rgba(124,92,252,0.14) 0%, rgba(79,70,229,0.10) 60%, rgba(79,70,229,0.06) 100%);
    border: 1px solid rgba(124,92,252,0.22);
    border-radius: var(--r-lg);
    padding: 16px 18px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
}
.hero-card::before {
    content: '';
    position: absolute;
    top: -50px; right: -50px;
    width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(124,92,252,0.18) 0%, transparent 70%);
}
.hero-card::after {
    content: '';
    position: absolute;
    bottom: -30px; left: -30px;
    width: 80px; height: 80px;
    background: radial-gradient(circle, rgba(124,92,252,0.10) 0%, transparent 70%);
}
.hero-avatar {
    width: 48px; height: 48px;
    border-radius: 16px;
    background: linear-gradient(145deg, var(--accent), #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 6px 22px var(--accent-glow);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.hero-text { flex: 1; min-width: 0; position: relative; z-index: 1; }
.hero-greet {
    font-size: 11px;
    color: var(--text-2);
    margin-bottom: 2px;
    letter-spacing: 0.3px;
}
.hero-user {
    font-family: var(--font-h);
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hero-vip {
    padding: 7px 16px;
    border-radius: 20px;
    font-family: var(--font-h);
    font-size: 12px;
    font-weight: 800;
    background: linear-gradient(135deg, #7c5cfc 0%, #4f46e5 100%);
    color: #fff !important;
    letter-spacing: 1px;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(124,92,252,0.70), 0 0 0 2px rgba(124,92,252,0.30);
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 4px rgba(0,0,0,0.30);
    animation: vipGlow 2.5s ease-in-out infinite;
}
@keyframes vipGlow {
    0%, 100% { box-shadow: 0 4px 20px rgba(124,92,252,0.70), 0 0 0 2px rgba(124,92,252,0.30); }
    50%       { box-shadow: 0 4px 28px rgba(124,92,252,0.95), 0 0 0 3px rgba(124,92,252,0.50); }
}

/* ---- STATS STRIP ---- */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 8px;
    margin-bottom: 20px;
}
.stat-pill {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 14px 10px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: border-color 0.25s;
}
.stat-pill:hover { border-color: var(--border-hi); }
.stat-pill::before {
    content: '';
    position: absolute;
    top: 0; left: 15%; right: 15%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.6;
}
.stat-n {
    font-family: var(--font-h);
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-l {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* ---- SECTION LABEL ---- */
.sec-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 0 2px;
    margin-bottom: 8px;
}

/* ---- SETTINGS-STYLE LIST ROWS ---- */
.settings-group {
    background: var(--bg-card);
    border-radius: var(--r);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 16px;
    backdrop-filter: blur(4px);
}
.settings-row {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    gap: 14px;
    cursor: pointer;
    transition: background 0.18s;
    border-bottom: 1px solid var(--divider);
    position: relative;
}
.settings-row:last-child { border-bottom: none; }
.settings-row:active { background: rgba(124,92,252,0.06); }
.settings-row:hover { background: rgba(255,255,255,0.015); }

.row-icon-wrap {
    width: 36px; height: 36px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.row-icon-wrap.orange { background: var(--accent-dim); }
.row-icon-wrap.teal   { background: var(--teal-dim); }
.row-icon-wrap.purple { background: var(--purple-dim); }
.row-icon-wrap.red    { background: var(--red-dim); }

.row-text { flex: 1; min-width: 0; }
.row-title {
    font-family: var(--font-h);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1px;
}
.row-sub {
    font-size: 11px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.row-arrow {
    font-size: 13px;
    color: var(--text-3);
    flex-shrink: 0;
}
.row-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 8px;
    flex-shrink: 0;
    letter-spacing: 0.3px;
}
.row-badge.orange { background: var(--accent-dim); color: var(--accent-2); }
.row-badge.teal   { background: var(--teal-dim);   color: var(--teal); }

/* ---- ADD BUTTONS STRIP ---- */
.btn-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}
.btn-main {
    padding: 14px 12px;
    border: none;
    border-radius: var(--r-sm);
    font-family: var(--font-h);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    letter-spacing: 0.3px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-main.primary {
    background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-main.primary:active { transform: scale(0.96); box-shadow: 0 2px 12px var(--accent-glow); }
.btn-main.secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-main.secondary:active { transform: scale(0.96); }
.btn-main.secondary:hover { border-color: var(--accent); color: var(--accent-2); box-shadow: 0 0 14px var(--accent-dim); }

/* ---- PAYLOAD ITEMS ---- */
.list { list-style: none; display: flex; flex-direction: column; gap: 7px; }

.list-item {
    display: flex;
    align-items: center;
    padding: 13px 14px;
    background: var(--bg-card);
    border-radius: var(--r);
    border: 1px solid var(--border);
    gap: 12px;
    transition: all 0.22s ease;
    cursor: pointer;
    animation: rowIn 0.3s ease both;
    position: relative;
    overflow: hidden;
}
.list-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--accent), var(--teal));
    opacity: 0;
    transition: opacity 0.22s;
}
.list-item:hover::before, .list-item:active::before { opacity: 1; }
.list-item:hover { border-color: rgba(124,92,252,0.18); transform: translateX(3px); }
.list-item:active { transform: scale(0.98); }

.item-icon {
    width: 40px; height: 40px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
}

.item-info { flex: 1; min-width: 0; }
.item-name {
    font-family: var(--font-h);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item-detail {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-2);
}
.item-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}
.item-tag.http   { background: var(--teal-dim);   color: var(--teal); }
.item-tag.ssl    { background: var(--purple-dim);  color: var(--purple); }
.item-tag.direct { background: var(--accent-dim);  color: var(--accent-2); }
.item-tag.sslpay { background: rgba(251,191,36,.08); color: #fbbf24; }

.item-btns {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}
.item-btn {
    width: 32px; height: 32px;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-2);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.item-btn:hover { background: var(--accent-dim); color: var(--accent-2); border-color: rgba(124,92,252,0.25); }
.item-btn.del:hover { background: var(--red-dim); color: var(--red); border-color: rgba(244,63,94,0.25); }

.flag {
    width: 28px; height: 19px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border);
}

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}
.empty-state .ei {
    font-size: 60px;
    display: block;
    margin-bottom: 14px;
    opacity: 0.35;
    filter: grayscale(1);
}
.empty-state h3 {
    font-family: var(--font-h);
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.empty-state p {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.7;
    max-width: 200px;
    margin: 0 auto;
}

/* =====================================================
   MODALS / BOTTOM SHEETS
===================================================== */
.modal {
    display: none;
    position: fixed; inset: 0;
    z-index: 500;
    align-items: flex-end;
    justify-content: center;
    background: rgba(3,4,10,0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.modal.show { display: flex; }

.modal-content {
    background: var(--bg-sheet);
    width: 100%;
    max-width: 430px;
    max-height: 92vh;
    overflow-y: auto;
    border-top-left-radius: var(--r-xl);
    border-top-right-radius: var(--r-xl);
    border: 1px solid var(--glass-border);
    border-bottom: none;
    box-shadow: 0 -24px 70px rgba(0,0,0,0.75);
    animation: sheetUp 0.3s cubic-bezier(0.16,1,0.3,1);
    scrollbar-width: none;
}
.modal-content::-webkit-scrollbar { display: none; }

/* sheet drag handle */
.sheet-handle {
    width: 38px; height: 4px;
    background: var(--text-3);
    border-radius: 2px;
    margin: 12px auto 0;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px 16px;
    border-bottom: 1px solid var(--divider);
    position: sticky; top: 0;
    background: var(--bg-sheet);
    z-index: 10;
}
.mh-icon {
    width: 34px; height: 34px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: var(--accent-dim);
    flex-shrink: 0;
}
.modal-header h2 {
    flex: 1;
    font-family: var(--font-h);
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}
.close, .close-btn {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-2);
    cursor: pointer;
    display: flex; align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
}
.close:hover, .close-btn:hover { color: var(--text); background: var(--red-dim); border-color: var(--red); }

.modal-body { padding: 16px 18px; }
.modal-footer {
    display: flex;
    gap: 8px;
    padding: 14px 18px;
    border-top: 1px solid var(--divider);
    position: sticky; bottom: 0;
    background: var(--bg-sheet);
    z-index: 10;
}

/* =====================================================
   FORM ELEMENTS — App-style labeled fields
===================================================== */
.form-group { margin-bottom: 14px; }

/* Colored label on top (matches the app style) */
.form-group label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    color: var(--accent-2);
    margin-bottom: 5px;
}
/* Teal labels for certain groups */
.form-group.teal label { color: var(--teal); }
.form-group.purple label { color: var(--purple); }
.form-group.orange label { color: var(--accent-2); }

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 11px 13px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    color: var(--text);
    border-radius: var(--r-sm);
    font-size: 13.5px;
    font-family: var(--font-b);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-3); }
.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' fill='%235b6080'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    padding-right: 32px;
    cursor: pointer;
}
.form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
}
/* Payload textarea enhanced mode (used for PAYSSL/http payload) */
#plPayloadTextarea {
    resize: vertical;
    min-height: 90px;
    max-height: 240px;
    font-family: 'Courier New', monospace;
    font-size: 12.5px;
    line-height: 1.7;
    letter-spacing: 0.01em;
    tab-size: 4;
    white-space: pre-wrap;
    word-break: break-all;
    transition: border-color 0.2s, box-shadow 0.2s, min-height 0.2s;
}
#plPayloadTextarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
    min-height: 120px;
}
.form-group input[disabled], .form-group input[readonly] {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 0;
}
.form-row .form-group {
    flex: 1;
    min-width: 110px;
    margin-bottom: 14px;
}

/* Mode chips */
.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 14px;
}
.radio-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 13px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    transition: all 0.2s ease;
}
.radio-inline:has(input:checked) {
    background: var(--accent-dim);
    border-color: rgba(124,92,252,0.35);
    color: var(--accent-2);
}
.radio-inline input[type="radio"] { display: none; }

.toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}
.toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--text-2);
    cursor: pointer;
    padding: 7px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 9px;
    transition: all 0.2s ease;
}
.toggle-label:has(input:checked) {
    background: var(--teal-dim);
    border-color: rgba(34,211,238,0.25);
    color: var(--teal);
}
.toggle-label input[type="checkbox"] {
    width: auto;
    accent-color: var(--accent);
}

/* =====================================================
   BUTTONS
===================================================== */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-h);
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}
.btn-primary {
    flex: 1;
    background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 6px 28px var(--accent-glow); transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.97); }

.btn-cancel {
    background: var(--bg-input);
    color: var(--text-2);
    border: 1px solid var(--border);
}
.btn-cancel:hover { background: var(--bg-card); color: var(--text); }
.btn-cancel:active { transform: scale(0.97); }

.btn-danger {
    flex: 1;
    background: linear-gradient(135deg, var(--red), #be123c);
    color: #fff;
    box-shadow: 0 4px 20px var(--red-glow);
}
.btn-danger:hover { box-shadow: 0 6px 28px var(--red-glow); transform: translateY(-1px); }

.btn-neutral {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-neutral:hover { background: var(--bg-input); }
.btn-accent {
    background: linear-gradient(135deg, var(--teal), #0891b2);
    color: #06070d;
    box-shadow: 0 4px 20px var(--teal-glow);
}

/* =====================================================
   SPECIAL MODALS
===================================================== */
/* Key modal */
.key-well {
    text-align: center;
    padding: 24px 4px 8px;
}
.key-em {
    width: 70px; height: 70px;
    border-radius: 22px;
    background: linear-gradient(145deg, var(--accent-dim), rgba(232,121,249,0.10));
    border: 1px solid rgba(124,92,252,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    margin: 0 auto 18px;
}
.key-title {
    font-family: var(--font-h);
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.key-sub {
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.7;
    max-width: 260px;
    margin: 0 auto 20px;
}

/* Spinner */
.spinner {
    width: 46px; height: 46px;
    border-radius: 50%;
    border: 3px solid var(--bg-card);
    border-top-color: var(--accent);
    animation: spin 0.75s linear infinite;
    box-shadow: 0 0 24px var(--accent-glow);
}
.spin-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 24px;
    gap: 14px;
}
.spin-txt {
    font-size: 13px;
    color: var(--text-2);
    font-weight: 500;
}

/* =====================================================
   TOAST
===================================================== */
.toast {
    position: fixed;
    bottom: calc(var(--bottomnav-h) + var(--safe) + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(24px);
    max-width: 340px;
    width: calc(100% - 32px);
    padding: 11px 18px;
    border-radius: 14px;
    font-family: var(--font-h);
    font-size: 13px;
    font-weight: 700;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.32s cubic-bezier(0.175,0.885,0.32,1.275);
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(12px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-success { background: rgba(124,92,252,0.92); color:#fff; box-shadow: 0 8px 30px var(--accent-glow); }
.toast.toast-success::before { content: '✓'; font-size:15px; }
.toast.toast-error   { background: rgba(244,63,94,0.92);  color:#fff; box-shadow: 0 8px 30px var(--red-glow); }
.toast.toast-error::before   { content: '✕'; font-size:15px; }
.toast.toast-info    { background: rgba(34,211,238,0.92);  color:#06070d; box-shadow: 0 8px 30px var(--teal-glow); }
.toast.toast-info::before    { content: 'ℹ'; font-size:15px; }

/* ---- SYNC OVERLAY ---- */
.sync-overlay {
    display: none; position: fixed; inset: 0; z-index: 9999;
    background: rgba(6,7,13,0.88); backdrop-filter: blur(8px);
    align-items: center; justify-content: center;
}
.sync-overlay.active { display: flex; }
.sync-dialog {
    text-align: center; padding: 48px 52px; border-radius: 26px;
    background: rgba(14,16,24,0.96); border: 1px solid var(--glass-border);
    box-shadow: 0 24px 70px rgba(0,0,0,0.65), 0 0 60px var(--accent-dim);
}
.sync-spinner {
    width: 52px; height: 52px; margin: 0 auto 24px; border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.06);
    border-top-color: var(--accent);
    animation: spin 0.85s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
.sync-label {
    color: #e8e8ed; font-size: 16px; font-weight: 600;
    letter-spacing: 0.2px; margin-bottom: 6px;
}
.sync-hint {
    color: rgba(255,255,255,0.40); font-size: 13px; margin: 0;
}
.sync-done .sync-spinner {
    animation: none; border-color: var(--green); border-top-color: var(--green);
}
.sync-done .sync-spinner::after {
    content: '✓'; display: flex; align-items: center; justify-content: center;
    height: 100%; color: var(--green); font-size: 28px; font-weight: 700;
}

/* =====================================================
   ANIMATIONS
===================================================== */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes sheetUp {
    from { transform: translateY(100%); opacity: 0.6; }
    to   { transform: translateY(0);    opacity: 1; }
}
@keyframes rowIn {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Ambient glow pulse — used on accent elements */
@keyframes ambientPulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 0.7; }
}

/* =====================================================
   SCROLLBARS
===================================================== */
::-webkit-scrollbar { width: 0; height: 0; }

/* =====================================================
   DESKTOP
===================================================== */
@media (min-width: 431px) {
    body {
        background: #030408;
        background-image:
            radial-gradient(ellipse at 20% 10%, rgba(124,92,252,0.06) 0%, transparent 50%),
            radial-gradient(ellipse at 80% 90%, rgba(34,211,238,0.04) 0%, transparent 50%);
        align-items: center;
        justify-content: center;
    }
    #phoneShell {
        border-radius: 44px;
        height: calc(100vh - 48px);
        max-height: 900px;
        border: 1px solid rgba(255,255,255,0.04);
        box-shadow:
            0 0 0 1px rgba(124,92,252,0.06),
            0 40px 120px rgba(0,0,0,0.92),
            0 0 80px rgba(124,92,252,0.04),
            inset 0 1px 0 rgba(255,255,255,0.03);
    }
    .modal { align-items: center; }
    .modal .modal-content {
        border-radius: var(--r-xl) !important;
        max-height: 88vh;
    }
    .modal .sheet-handle { display: none; }
}

/* =====================================================
   TAB VIEWS
===================================================== */
.tab-view {
    display: none;
    animation: fadeIn 0.28s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.tab-view.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   TELA DE ATIVAÇÃO (LOGIN SCREEN)
===================================================== */
#loginScreen {
    width: 100%;
    height: calc(100% - var(--status-h));
    display: flex;
    flex-direction: column;
    background: radial-gradient(ellipse at top, rgba(124, 92, 252, 0.10) 0%, var(--bg) 70%);
    overflow-y: auto;
    z-index: 10;
}

.login-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--safe) 24px;
    width: 100%;
}

.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: linear-gradient(145deg, var(--accent) 0%, #4f46e5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    margin-bottom: 16px;
    box-shadow: 0 10px 30px var(--accent-glow);
    animation: pulseGlow 3s infinite ease-in-out;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 10px 30px var(--accent-glow); transform: scale(1); }
    50% { box-shadow: 0 12px 40px rgba(124, 92, 252, 0.40); transform: scale(1.03); }
}

.login-title {
    font-family: var(--font-h);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.1;
    margin-bottom: 4px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 50%, var(--teal) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 32px;
    letter-spacing: 0.3px;
    font-weight: 500;
}

.login-card {
    width: 100%;
    max-width: 330px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--r);
    padding: 24px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.45), 0 0 40px var(--accent-dim);
    animation: slideUpIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
    backdrop-filter: blur(8px);
}

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

.login-card-header {
    text-align: center;
    margin-bottom: 22px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
}

.login-card-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.login-card-title {
    font-family: var(--font-h);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}

.login-card-subtitle {
    font-size: 11px;
    color: var(--text-2);
    line-height: 1.3;
}

.btn-login {
    width: 100%;
    padding: 14px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 100%) !important;
    box-shadow: 0 4px 20px var(--accent-glow);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-top: 6px;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(124, 92, 252, 0.40);
}

.btn-login:active {
    transform: translateY(1px);
}

.login-footer {
    margin-top: auto;
    padding-top: 40px;
    text-align: center;
    font-size: 10px;
    color: var(--text-3);
    letter-spacing: 2px;
    font-weight: 800;
}

/* =====================================================
   PREMIUM LIGHT THEME & MODAL OVERRIDES
   ===================================================== */
html.light .hero-card {
    background: linear-gradient(135deg, rgba(124, 92, 252, 0.07) 0%, rgba(79, 70, 229, 0.04) 100%);
    border: 1px solid rgba(124, 92, 252, 0.16);
    box-shadow: 0 8px 30px -8px rgba(124, 92, 252, 0.10);
}

html.light .hero-vip {
    box-shadow: 0 4px 12px rgba(124, 92, 252, 0.30), 0 0 0 2px rgba(124, 92, 252, 0.18);
    animation: vipGlowLight 2.5s ease-in-out infinite;
}

html.light .login-card {
    box-shadow: 0 20px 48px rgba(124, 92, 252, 0.08), 0 0 40px rgba(124, 92, 252, 0.03);
    border: 1px solid rgba(124, 92, 252, 0.12);
}

html.light .modal {
    background: rgba(15, 23, 42, 0.40);
}

html.light .list-item {
    box-shadow: 0 4px 16px -4px rgba(20, 25, 43, 0.04);
}

html.light .list-item:hover {
    border-color: rgba(124, 92, 252, 0.22);
    box-shadow: 0 8px 24px -4px rgba(124, 92, 252, 0.08);
}

html.light .settings-row:hover {
    background: rgba(0, 0, 0, 0.015);
}

html.light .form-group input,
html.light .form-group select,
html.light .form-group textarea {
    background: #fcfdfe;
    border-color: rgba(0, 0, 0, 0.08);
}

html.light .form-group input:focus,
html.light .form-group select:focus,
html.light .form-group textarea:focus {
    background: #ffffff;
    border-color: var(--accent);
}

html.light .close, html.light .close-btn {
    opacity: 0.75;
    background: rgba(0, 0, 0, 0.04);
}

html.light .close:hover, html.light .close-btn:hover {
    opacity: 1;
    background: var(--red-dim);
    border-color: var(--red);
}

@keyframes vipGlowLight {
    0%, 100% { box-shadow: 0 4px 12px rgba(124, 92, 252, 0.30), 0 0 0 2px rgba(124, 92, 252, 0.18); }
    50%       { box-shadow: 0 4px 20px rgba(124, 92, 252, 0.45), 0 0 0 3px rgba(124, 92, 252, 0.25); }
}

/* =====================================================
   SWEETALERT2 INTEGRATED DESIGN SYSTEM
   ===================================================== */
.swal2-popup {
    background: var(--bg-card) !important;
    color: var(--text) !important;
    border-radius: var(--r) !important;
    border: 1px solid var(--border) !important;
    font-family: var(--font-b) !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3) !important;
}
html.light .swal2-popup {
    box-shadow: 0 20px 50px rgba(124, 92, 252, 0.08) !important;
}
.swal2-title {
    color: var(--text) !important;
    font-family: var(--font-h) !important;
    font-weight: 700 !important;
}
.swal2-html-container {
    color: var(--text-2) !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
}
.swal2-confirm {
    background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 100%) !important;
    box-shadow: 0 4px 18px var(--accent-glow) !important;
    border-radius: var(--r-sm) !important;
    font-family: var(--font-h) !important;
    font-weight: 600 !important;
    font-size: 13.5px !important;
    padding: 12px 24px !important;
}
.swal2-cancel {
    background: var(--bg-input) !important;
    color: var(--text-2) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-sm) !important;
    font-family: var(--font-h) !important;
    font-weight: 600 !important;
    font-size: 13.5px !important;
    padding: 12px 24px !important;
}
.swal2-input, .swal2-textarea {
    background-color: var(--bg-input) !important;
    color: var(--text) !important;
    border: 1.5px solid var(--border) !important;
    border-radius: var(--r-sm) !important;
    font-family: var(--font-b) !important;
    font-size: 14px !important;
    box-shadow: none !important;
}
.swal2-input:focus, .swal2-textarea:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-dim) !important;
}

/* Non-VIP styling */
.hero-vip.non-vip {
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--text-3) !important;
    box-shadow: none !important;
    border: 1px solid var(--border) !important;
    animation: none !important;
}
html.light .hero-vip.non-vip {
    background: rgba(0, 0, 0, 0.04) !important;
    color: var(--text-2) !important;
    border-color: rgba(0, 0, 0, 0.05) !important;
}
