/* ============================================
   TAKUMI PROXY — PERSONAL DASHBOARD
   ============================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(17, 24, 39, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.07);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;

    --accent-primary: #6C5CE7;
    --accent-secondary: #00D2FF;
    --accent-gradient: linear-gradient(135deg, #6C5CE7 0%, #00D2FF 100%);

    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;

    --border-color: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(108, 92, 231, 0.3);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(108, 92, 231, 0.15);

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

body.tg-webapp {
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ---- Animated Background ---- */
.bg-grid {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none; z-index: 0;
}

.bg-glow {
    position: fixed; border-radius: 50%; filter: blur(80px);
    pointer-events: none; z-index: 0;
    animation: floatGlow 15s ease-in-out infinite;
}
.bg-glow--1 { width: 300px; height: 300px; background: rgba(108, 92, 231, 0.12); top: -80px; right: -60px; }
.bg-glow--2 { width: 250px; height: 250px; background: rgba(0, 210, 255, 0.08); bottom: 20%; left: -80px; animation-delay: -5s; }
.bg-glow--3 { width: 200px; height: 200px; background: rgba(108, 92, 231, 0.06); bottom: -40px; right: 20%; animation-delay: -10s; }

@keyframes floatGlow {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-10px, 20px) scale(0.9); }
}

/* ---- App Container ---- */
.app {
    position: relative; z-index: 1;
    max-width: 480px; margin: 0 auto;
    padding: var(--space-md); padding-bottom: 90px;
    animation: fadeInUp 0.6s var(--ease-out) both;
}

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

/* ---- Screens ---- */
.screen {
    animation: fadeInUp 0.4s var(--ease-out) both;
}

.screen__header {
    display: flex; align-items: center; gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.screen__title {
    font-size: 1.25rem; font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

.screen__desc {
    font-size: 0.85rem; color: var(--text-secondary);
    margin-bottom: var(--space-lg); line-height: 1.6;
}

.back-btn {
    width: 36px; height: 36px; border-radius: var(--radius-md);
    background: var(--bg-glass); border: 1px solid var(--border-color);
    color: var(--text-primary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--duration-normal) var(--ease-out);
}
.back-btn:hover { background: var(--bg-glass-hover); border-color: var(--border-accent); }

/* ---- Loading ---- */
.loading {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; min-height: 60vh; gap: var(--space-lg);
}

.loading__spinner {
    width: 40px; height: 40px; border-radius: 50%;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading__text { color: var(--text-tertiary); font-size: 0.9rem; }

/* ---- Auth Screen ---- */
.auth {
    display: flex; flex-direction: column; align-items: center;
    min-height: 80vh; justify-content: center; padding: var(--space-lg) 0;
}

.auth__logo { text-align: center; margin-bottom: var(--space-xl); }

.auth__logo-icon {
    font-size: 3rem; margin-bottom: var(--space-sm);
    filter: drop-shadow(0 0 20px rgba(108, 92, 231, 0.4));
}

.auth__title {
    font-size: 1.75rem; font-weight: 900;
    background: var(--accent-gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth__subtitle { color: var(--text-tertiary); font-size: 0.9rem; margin-top: var(--space-xs); }

.auth__tabs {
    display: flex; width: 100%; background: var(--bg-glass);
    border-radius: var(--radius-md); padding: 3px;
    margin-bottom: var(--space-lg); border: 1px solid var(--border-color);
}

.auth__tab {
    flex: 1; padding: 10px; border: none; background: none;
    color: var(--text-tertiary); font-family: inherit;
    font-size: 0.9rem; font-weight: 600; cursor: pointer;
    border-radius: calc(var(--radius-md) - 2px);
    transition: all var(--duration-normal) var(--ease-out);
}

.auth__tab--active {
    background: var(--accent-gradient);
    color: white; box-shadow: var(--shadow-md);
}

.auth__form {
    width: 100%; display: flex; flex-direction: column;
    gap: var(--space-md);
}

.input-group {
    display: flex; flex-direction: column; gap: var(--space-xs);
}

.input-label {
    font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
    padding-left: 2px;
}

.input {
    width: 100%; padding: 14px var(--space-md);
    background: var(--bg-glass); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); color: var(--text-primary);
    font-family: inherit; font-size: 0.95rem;
    transition: all var(--duration-normal) var(--ease-out);
    outline: none;
}

.input::placeholder { color: var(--text-tertiary); }
.input:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15); }

.auth__message {
    width: 100%; padding: var(--space-md); border-radius: var(--radius-md);
    font-size: 0.85rem; text-align: center; margin-top: var(--space-md);
}
.auth__message--success { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.auth__message--error { background: rgba(239, 68, 68, 0.1); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.2); }

.auth__footer {
    margin-top: var(--space-xl); color: var(--text-tertiary);
    font-size: 0.8rem; text-align: center; line-height: 1.6;
}
.auth__footer a { color: var(--accent-secondary); text-decoration: none; font-weight: 600; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: var(--space-sm); padding: 14px var(--space-lg);
    border-radius: var(--radius-md); font-family: inherit;
    font-size: 0.9rem; font-weight: 700; cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    border: none; position: relative; overflow: hidden;
}

.btn--primary {
    background: var(--accent-gradient); color: white;
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 6px 30px rgba(108, 92, 231, 0.4); }
.btn--primary:active { transform: translateY(0) scale(0.98); }

.btn--outline {
    background: transparent; color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn--outline:hover { border-color: var(--border-accent); background: var(--bg-glass); }

.btn--full { width: 100%; }

.btn.loading .btn__text { opacity: 0; }
.btn.loading .btn__spinner { display: block; }

.btn__spinner {
    display: none; width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3); border-top-color: white;
    animation: spin 0.6s linear infinite;
    position: absolute; left: 50%; top: 50%;
    margin-left: -10px; margin-top: -10px;
}

/* ---- Header ---- */
.header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-md) 0; margin-bottom: var(--space-md);
}

.header__logo { display: flex; align-items: center; gap: var(--space-md); }

.header__icon {
    width: 42px; height: 42px; display: flex;
    align-items: center; justify-content: center;
    background: var(--bg-glass); border: 1px solid var(--border-accent);
    border-radius: var(--radius-md); box-shadow: var(--shadow-glow);
}
.header__icon svg { width: 24px; height: 24px; }

.header__title {
    font-size: 1.25rem; font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; letter-spacing: -0.02em;
}

.header__subtitle { font-size: 0.75rem; color: var(--text-tertiary); font-weight: 500; }

.header__status {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-full); font-size: 0.75rem;
    font-weight: 600; color: var(--success);
}

.status-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--success); animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-xl); overflow: hidden;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: fadeInUp 0.6s var(--ease-out) 0.1s both;
}

.card--subscription { position: relative; }
.card--subscription::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0;
    height: 2px; background: var(--accent-gradient);
}

.card__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-lg); padding-bottom: 0;
}

.card__badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 14px; border-radius: var(--radius-full);
    font-size: 0.8rem; font-weight: 600;
}
.card__badge--active { background: rgba(16, 185, 129, 0.12); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.card__badge--expired { background: rgba(239, 68, 68, 0.12); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.2); }
.card__badge--warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }

.card__badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 2s ease-in-out infinite; }

.card__plan {
    font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
    padding: 5px 14px; background: var(--bg-glass);
    border-radius: var(--radius-full); border: 1px solid var(--border-color);
}

.card__body { padding: var(--space-lg); display: flex; flex-direction: column; gap: var(--space-lg); }

/* ---- Battery Widget ---- */
.battery { display: flex; flex-direction: column; gap: var(--space-md); }

.battery__body { display: flex; align-items: center; gap: 0; padding: 0 var(--space-xs); }

.battery__shell {
    flex: 1; height: 80px; background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.08); border-radius: 14px;
    position: relative; overflow: hidden; transition: border-color 0.5s ease;
}
.battery--high .battery__shell { border-color: rgba(16, 185, 129, 0.25); }
.battery--mid .battery__shell { border-color: rgba(245, 158, 11, 0.25); }
.battery--low .battery__shell { border-color: rgba(239, 68, 68, 0.3); }

.battery__fill {
    position: absolute; top: 4px; left: 4px; bottom: 4px;
    width: 0%; border-radius: 10px;
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.5s ease;
    overflow: hidden;
}
.battery--high .battery__fill {
    background: linear-gradient(90deg, #059669, #10B981, #34D399);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}
.battery--mid .battery__fill {
    background: linear-gradient(90deg, #D97706, #F59E0B, #FBBF24);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}
.battery--low .battery__fill {
    background: linear-gradient(90deg, #DC2626, #EF4444, #F87171);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
    animation: batteryPulse 1.5s ease-in-out infinite;
}

@keyframes batteryPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

.battery__fill-shimmer {
    position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: batteryShimmer 3s ease-in-out infinite;
}
@keyframes batteryShimmer { 0% { left: -120%; } 100% { left: 200%; } }

.battery__segments {
    position: absolute; top: 4px; left: 4px; right: 4px; bottom: 4px;
    display: flex; gap: 3px; pointer-events: none; z-index: 2;
}
.battery__segment { flex: 1; border-right: 1px solid rgba(255, 255, 255, 0.04); }
.battery__segment:last-child { border-right: none; }

.battery__center-info {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    display: flex; align-items: baseline; gap: 5px; z-index: 3;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.battery__days-value { font-size: 2rem; font-weight: 900; color: #fff; line-height: 1; font-variant-numeric: tabular-nums; }
.battery__days-label { font-size: 0.8rem; font-weight: 600; color: rgba(255, 255, 255, 0.8); }

.battery__cap {
    width: 8px; height: 32px; background: rgba(255, 255, 255, 0.1);
    border-radius: 0 4px 4px 0; border: 2px solid rgba(255, 255, 255, 0.08);
    border-left: none; flex-shrink: 0; transition: background 0.5s ease;
}
.battery--high .battery__cap { background: rgba(16, 185, 129, 0.2); border-color: rgba(16, 185, 129, 0.25); }
.battery--mid .battery__cap { background: rgba(245, 158, 11, 0.2); border-color: rgba(245, 158, 11, 0.25); }
.battery--low .battery__cap { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.3); }

.battery__details { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-sm) var(--space-xs); }
.battery__detail { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.battery__detail-label { font-size: 0.7rem; color: var(--text-tertiary); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.battery__detail-value { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
.battery__detail-value--unlimited { display: flex; align-items: center; gap: 5px; color: var(--accent-secondary); }
.battery__detail-value--unlimited svg { opacity: 0.8; }
.battery__detail-divider { width: 1px; height: 32px; background: var(--border-color); flex-shrink: 0; }

/* ---- No Subscription Banner ---- */
.no-sub {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-xl); padding: var(--space-xl);
    text-align: center; animation: fadeInUp 0.6s var(--ease-out) 0.1s both;
}
.no-sub__icon { font-size: 2.5rem; margin-bottom: var(--space-md); }
.no-sub__title { font-size: 1.1rem; font-weight: 700; margin-bottom: var(--space-sm); }
.no-sub__text { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: var(--space-lg); }

/* ---- Sections ---- */
.section { margin-top: var(--space-lg); animation: fadeInUp 0.6s var(--ease-out) 0.2s both; }

.section__title {
    display: flex; align-items: center; gap: var(--space-sm);
    font-size: 1rem; font-weight: 700; color: var(--text-primary);
    margin-bottom: var(--space-md);
}
.section__title svg { color: var(--accent-secondary); flex-shrink: 0; }

/* ---- Connect Grid ---- */
.connect-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); margin-bottom: var(--space-md); }

.connect-btn {
    display: flex; flex-direction: column; align-items: flex-start;
    gap: var(--space-sm); padding: var(--space-lg);
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative; overflow: hidden;
    backdrop-filter: blur(20px); color: var(--text-primary);
    text-align: left; font-family: inherit;
}
.connect-btn:hover { transform: translateY(-2px); border-color: var(--border-accent); box-shadow: var(--shadow-md), var(--shadow-glow); }
.connect-btn:active { transform: translateY(0) scale(0.98); }

.connect-btn__icon {
    width: 40px; height: 40px; display: flex;
    align-items: center; justify-content: center;
    border-radius: var(--radius-md);
}
.connect-btn--v2ray .connect-btn__icon { background: rgba(108, 92, 231, 0.15); color: var(--accent-primary); }
.connect-btn--happ .connect-btn__icon { background: rgba(0, 210, 255, 0.15); color: var(--accent-secondary); }
.connect-btn__icon svg { width: 22px; height: 22px; }

.connect-btn__text { display: flex; flex-direction: column; }
.connect-btn__name { font-size: 0.95rem; font-weight: 700; }
.connect-btn__desc { font-size: 0.7rem; color: var(--text-tertiary); font-weight: 500; }

/* ---- Copy Button ---- */
.copy-btn {
    width: 100%; display: flex; align-items: center; gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--accent-gradient); border: none;
    border-radius: var(--radius-lg); cursor: pointer;
    font-family: inherit; font-size: 0.9rem; font-weight: 700;
    color: white; transition: all var(--duration-normal) var(--ease-out);
    position: relative; overflow: hidden;
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
}
.copy-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 30px rgba(108, 92, 231, 0.4); }
.copy-btn:active { transform: translateY(0) scale(0.98); }

.copy-btn__icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.copy-btn__icon svg { width: 20px; height: 20px; }
.copy-btn__text { flex: 1; text-align: left; }
.copy-btn__success { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; opacity: 0; transform: scale(0); transition: all var(--duration-normal) var(--ease-spring); }
.copy-btn__success svg { width: 20px; height: 20px; }

.copy-btn.copied .copy-btn__icon { opacity: 0; transform: scale(0); transition: all var(--duration-normal) var(--ease-spring); }
.copy-btn.copied .copy-btn__success { opacity: 1; transform: scale(1); }
.copy-btn.copied { background: linear-gradient(135deg, var(--success), #059669); box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3); }

/* ---- Plans ---- */
.plans { display: flex; flex-direction: column; gap: var(--space-md); }

.plan-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-xl); padding: var(--space-lg);
    transition: all var(--duration-normal) var(--ease-out);
    cursor: pointer; position: relative; overflow: hidden;
}
.plan-card:hover { transform: translateY(-2px); border-color: var(--border-accent); box-shadow: var(--shadow-md), var(--shadow-glow); }
.plan-card:active { transform: scale(0.98); }

.plan-card--popular { border-color: var(--accent-primary); }
.plan-card--popular::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0;
    height: 2px; background: var(--accent-gradient);
}

.plan-card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-md); }

.plan-card__name { font-size: 1.1rem; font-weight: 800; }

.plan-card__tag {
    padding: 4px 10px; border-radius: var(--radius-full);
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    background: var(--accent-gradient); color: white;
}

.plan-card__price {
    display: flex; align-items: baseline; gap: var(--space-xs);
    margin-bottom: var(--space-md);
}
.plan-card__amount { font-size: 1.75rem; font-weight: 900; }
.plan-card__currency { font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.plan-card__period { font-size: 0.8rem; color: var(--text-tertiary); margin-left: var(--space-xs); }

.plan-card__features { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.plan-card__feature {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.75rem; color: var(--text-secondary);
    padding: 4px 10px; background: var(--bg-glass);
    border-radius: var(--radius-full); border: 1px solid var(--border-color);
}

.plan-skeleton {
    height: 140px; background: var(--bg-glass);
    border-radius: var(--radius-xl); border: 1px solid var(--border-color);
    animation: skeletonPulse 1.5s ease-in-out infinite;
}
@keyframes skeletonPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.8; } }

/* ---- Payment ---- */
.payment-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-xl); padding: var(--space-xl);
    text-align: center; display: flex; flex-direction: column;
    gap: var(--space-md);
}
.payment-card__plan { font-size: 1rem; color: var(--text-secondary); font-weight: 600; }
.payment-card__price {
    font-size: 2.5rem; font-weight: 900;
    background: var(--accent-gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.payment-card__status {
    padding: var(--space-md); border-radius: var(--radius-md);
    font-size: 0.85rem; font-weight: 600;
}
.payment-card__status--success { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.payment-card__status--error { background: rgba(239, 68, 68, 0.1); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.2); }
.payment-card__status--pending { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }

/* ---- History ---- */
.history { display: flex; flex-direction: column; gap: var(--space-sm); }

.history__empty {
    text-align: center; padding: var(--space-2xl);
    color: var(--text-tertiary);
}
.history__empty-icon { font-size: 2rem; margin-bottom: var(--space-md); }

.history__item {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all var(--duration-fast) ease;
}
.history__item:hover { background: var(--bg-card-hover); }

.history__item-left { display: flex; flex-direction: column; gap: 2px; }
.history__item-amount { font-size: 1rem; font-weight: 700; }
.history__item-date { font-size: 0.75rem; color: var(--text-tertiary); }

.history__item-status {
    padding: 4px 10px; border-radius: var(--radius-full);
    font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
}
.history__item-status--succeeded { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.history__item-status--pending { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.history__item-status--canceled { background: rgba(239, 68, 68, 0.12); color: var(--error); }

/* ---- Tab Bar ---- */
.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: rgba(10, 14, 26, 0.95);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    display: flex; justify-content: center; z-index: 1000;
    padding: var(--space-sm) 0;
    padding-bottom: max(var(--space-sm), env(safe-area-inset-bottom, 8px));
    will-change: transform;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.tabbar__item {
    flex: 1; max-width: 120px; display: flex; flex-direction: column;
    align-items: center; gap: 2px; padding: var(--space-sm) 0;
    background: none; border: none; color: var(--text-tertiary);
    font-family: inherit; font-size: 0.65rem; font-weight: 600;
    cursor: pointer; transition: all var(--duration-normal) var(--ease-out);
}
.tabbar__item:hover { color: var(--text-secondary); }
.tabbar__item--active { color: var(--accent-secondary); }
.tabbar__item--active svg { filter: drop-shadow(0 0 6px rgba(0, 210, 255, 0.4)); }

/* ---- Toast ---- */
.toast {
    position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
    display: flex; align-items: center; gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: rgba(17, 24, 39, 0.95); border: 1px solid var(--border-accent);
    border-radius: var(--radius-full); font-size: 0.85rem;
    color: var(--text-primary); white-space: nowrap;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    opacity: 0; pointer-events: none;
    transition: all var(--duration-normal) var(--ease-out); z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast__icon { color: var(--success); display: flex; }
.toast__icon svg { width: 18px; height: 18px; }

/* ---- Responsive ---- */
@media (max-width: 400px) {
    .app { padding: var(--space-sm); padding-bottom: 90px; }
    .card__body { padding: var(--space-md); }
    .battery__days-value { font-size: 1.5rem; }
    .connect-btn { padding: var(--space-md); }
}

/* ---- Profile Screen ---- */
.profile-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-lg);
}

.profile-card__avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--bg-glass);
    border: 2px solid var(--border-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: var(--shadow-glow);
}

.profile-card__info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-card__name {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
}

.profile-card__subtext {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.profile-email-card {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.profile-email-card__status {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
}

/* ---- Telegram Theme Integration ---- */
body.tg-webapp {
    --bg-primary: var(--tg-theme-bg-color, #0a0e1a);
    --text-primary: var(--tg-theme-text-color, #f1f5f9);
    --text-secondary: var(--tg-theme-hint-color, #94a3b8);
    --text-tertiary: var(--tg-theme-hint-color, #64748b);

    --bg-secondary: var(--tg-theme-secondary-bg-color, color-mix(in srgb, var(--bg-primary) 93%, var(--text-primary) 7%));
    --bg-card: var(--tg-theme-section-bg-color, var(--tg-theme-secondary-bg-color, color-mix(in srgb, var(--bg-primary) 95%, var(--text-primary) 5%)));
    --bg-card-hover: var(--tg-theme-section-bg-color, var(--tg-theme-secondary-bg-color, color-mix(in srgb, var(--bg-primary) 90%, var(--text-primary) 10%)));
    --bg-glass: color-mix(in srgb, var(--bg-primary) 97%, var(--text-primary) 3%);
    --bg-glass-hover: color-mix(in srgb, var(--bg-primary) 93%, var(--text-primary) 7%);

    --accent-primary: var(--tg-theme-button-color, #6C5CE7);
    --accent-secondary: var(--tg-theme-link-color, #00D2FF);
    --accent-gradient: linear-gradient(135deg, var(--tg-theme-button-color, #6C5CE7) 0%, var(--tg-theme-link-color, #00D2FF) 100%);

    --border-color: color-mix(in srgb, var(--bg-primary) 90%, var(--text-primary) 10%);
    --border-accent: var(--tg-theme-button-color, rgba(108, 92, 231, 0.3));

    background: var(--bg-primary);
    color: var(--text-primary);
}

body.tg-webapp .bg-grid,
body.tg-webapp .bg-glow {
    display: none !important;
}

body.tg-webapp .input {
    background: var(--bg-secondary);
}

body.tg-webapp .tabbar {
    background: var(--bg-secondary);
}

body.tg-webapp .btn--primary {
    background: var(--accent-gradient);
    color: var(--tg-theme-button-text-color, white);
}

body.tg-webapp .battery__shell {
    background: color-mix(in srgb, var(--bg-primary) 85%, var(--text-primary) 15%);
    border-color: color-mix(in srgb, var(--bg-primary) 80%, var(--text-primary) 20%);
}

body.tg-webapp .battery__cap {
    background: color-mix(in srgb, var(--bg-primary) 80%, var(--text-primary) 20%);
    border-color: color-mix(in srgb, var(--bg-primary) 78%, var(--text-primary) 22%);
}
