:root {
    --bg: #0B0F16;
    --surface: #131A26;
    --surface-2: #1A2333;
    --border: #232E42;
    --text: #E8EDF5;
    --text-dim: #8B98AC;
    --accent: #38BDF8;
    --accent-2: #6EE7B7;
    --danger: #F87171;
    --warn: #FBBF24;
    --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

body {
    min-height: 100vh;
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

.hidden { display: none !important; }

.header {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    background: rgba(11, 15, 22, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.header__title {
    font-weight: 700; font-size: 17px;
    background: var(--grad);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.header__balance {
    font-weight: 600; font-size: 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; padding: 4px 12px;
}

main { padding: 16px 16px 8px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
}
.card__title {
    font-size: 13px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 12px;
}

.row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 6px 0;
}
.row + .row { border-top: 1px solid var(--border); }
.row__label { color: var(--text-dim); }
.row__value { font-weight: 600; text-align: right; word-break: break-word; }

.badge {
    display: inline-block; padding: 2px 10px;
    border-radius: 999px; font-size: 13px; font-weight: 600;
}
.badge--active { background: rgba(110, 231, 183, 0.15); color: var(--accent-2); }
.badge--expired, .badge--disabled { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
.badge--limited { background: rgba(251, 191, 36, 0.15); color: var(--warn); }
.badge--none { background: var(--surface-2); color: var(--text-dim); }

.progress {
    height: 8px; border-radius: 999px;
    background: var(--surface-2); overflow: hidden; margin-top: 8px;
}
.progress__bar {
    height: 100%; width: 0;
    background: var(--grad); border-radius: 999px;
    transition: width 0.4s ease;
}
.progress__label { font-size: 13px; color: var(--text-dim); margin-top: 6px; }

.btn {
    display: block; width: 100%;
    padding: 13px 16px; margin-top: 10px;
    border: none; border-radius: 12px;
    font-size: 15px; font-weight: 600; color: #06090F;
    cursor: pointer; text-align: center;
}
.btn--primary { background: var(--grad); }
.btn--ghost {
    background: transparent; color: var(--text);
    border: 1px solid var(--border);
}
.btn--danger {
    background: transparent; color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.35);
    width: auto; padding: 7px 14px; margin-top: 0;
    font-size: 13px;
}
.btn:active { opacity: 0.85; }

.device {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 12px 0;
}
.device + .device { border-top: 1px solid var(--border); }
.device__name { font-weight: 600; }
.device__meta { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.device__dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent-2); margin-right: 6px;
}

.tariff {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 12px 0;
}
.tariff + .tariff { border-top: 1px solid var(--border); }
.tariff__name { font-weight: 600; }
.tariff__meta { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.tariff__price { text-align: right; white-space: nowrap; }
.tariff__price-old {
    font-size: 13px; color: var(--text-dim); text-decoration: line-through;
}
.tariff__price-new { font-weight: 700; font-size: 16px; }
.tariff__discount { font-size: 12px; color: var(--accent-2); }

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: flex;
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(11, 15, 22, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
}
.tabbar__btn {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 9px 0 7px;
    background: none; border: none;
    color: var(--text-dim); font-size: 11px;
    cursor: pointer;
}
.tabbar__btn span:first-child { font-size: 20px; }
.tabbar__btn.active { color: var(--accent); }

.toast {
    position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    max-width: 90vw;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 18px; border-radius: 12px;
    font-size: 14px; z-index: 50;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.toast--error { border-color: rgba(248, 113, 113, 0.5); color: var(--danger); }

.auth-error {
    position: fixed; inset: 0; z-index: 100;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center; padding: 32px;
    background: var(--bg);
}
.auth-error__icon { font-size: 44px; margin-bottom: 12px; }
.auth-error h2 { margin-bottom: 8px; }
.auth-error p { color: var(--text-dim); margin-bottom: 6px; }
.auth-error .btn { max-width: 260px; margin-top: 18px; }

.skeleton {
    color: var(--text-dim); text-align: center; padding: 32px 0;
}

.empty {
    color: var(--text-dim); text-align: center; padding: 20px 0;
}
