:root {
  --bg-color: #111419;
  --bg-glass: rgba(255, 255, 255, 0.05);
  --bg-dock: #181d26;
  --bg-pill: rgba(255, 255, 255, 0.06);
  --border-glass: rgba(255, 255, 255, 0.09);
  --border-highlight: rgba(255, 255, 255, 0.15);
  --blur-glass: 12px;
  --text-primary: #ffffff;
  --text-secondary: #9aa7bc;
  --text-muted: #5e6b80;
  --accent-cyan: #38bdf8;
  --accent-blue: #2563eb;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-accent: 'Unbounded', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

::-webkit-scrollbar,
*::-webkit-scrollbar,
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.app-container::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
  opacity: 0 !important;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family: var(--font-main);
  color: var(--text-primary);
  overscroll-behavior: none;
  cursor: default;
}

/* Background WebGL Canvas (Fixed behind everything) */
#glcanvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1;
  pointer-events: none;
  background-color: var(--bg-color);
}

/* Main App Container (Smooth Scrollable) */
.app-container {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-width: none !important;
  padding: calc(env(safe-area-inset-top, 12px) + 14px) 20px 0 20px;
}

/* Top Navigation / Header Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  margin-bottom: 24px;
}

/* User Pill in Top-Left */
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-pill);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  padding: 5px 14px 5px 5px;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-avatar img.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-initial {
  font-family: var(--font-accent);
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
}

.user-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #f1f5f9;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* Main Content Area */
.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  min-height: 480px;
}

/* Tab Switching Content Views */
.tab-content {
  display: none;
  flex-direction: column;
  width: 100%;
}

.tab-content.active {
  display: flex;
}

/* Explicit bottom space so content stops cleanly right above the floating dockbar */
.tab-bottom-spacer {
  width: 100%;
  height: calc(env(safe-area-inset-bottom, 12px) + 94px);
  min-height: calc(env(safe-area-inset-bottom, 12px) + 94px);
  flex-shrink: 0;
  pointer-events: none;
}

/* ==========================================================================
   Fluid Directional Page Flip Transition (Non-overlapping, Zero-vignette)
   - 0% Opacity changes: Frosted glass (backdrop-filter) never darkens
   - Single active layer at any time: Completely eliminates WebKit backdrop-filter vignette/halo
   - No container clipping: Zero clipped edges or severed box-shadows
   - Apple fluid deceleration curve for natural, premium glide
   ========================================================================== */

/* Exit animations (140ms quick momentum sweep) */
.tab-content.flip-glide-out-left {
  display: flex !important;
  pointer-events: none;
  animation: flipGlideOutLeft 0.14s cubic-bezier(0.35, 0, 0.8, 0.4) forwards;
}

.tab-content.flip-glide-out-right {
  display: flex !important;
  pointer-events: none;
  animation: flipGlideOutRight 0.14s cubic-bezier(0.35, 0, 0.8, 0.4) forwards;
}

/* Enter animations (240ms Apple fluid deceleration glide) */
.tab-content.flip-glide-in-right {
  display: flex !important;
  animation: flipGlideInRight 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.tab-content.flip-glide-in-left {
  display: flex !important;
  animation: flipGlideInLeft 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes flipGlideOutLeft {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-36px, 0, 0);
  }
}

@keyframes flipGlideOutRight {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(36px, 0, 0);
  }
}

@keyframes flipGlideInRight {
  0% {
    transform: translate3d(44px, 0, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes flipGlideInLeft {
  0% {
    transform: translate3d(-44px, 0, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

/* Section Title */
.section-header {
  margin-bottom: 10px;
}

.section-title {
  font-family: var(--font-accent);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.6);
}

/* Pure Frosted Glass Card */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-glass));
  -webkit-backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: 26px;
  overflow: hidden;
  padding: 24px;
  box-shadow: 
    0 16px 40px rgba(0, 0, 0, 0.35),
    inset 0 1px 1px var(--border-highlight);
  transition: transform 0.2s ease;
}

/* Card Header */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.status-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.status-label {
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: normal;
}

.status-value {
  font-family: var(--font-accent);
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

/* Tasteful, understated frosted lock icon */
.card-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Card Body Information Rows */
.card-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 24px;
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}

.info-label {
  color: var(--text-secondary);
}

.info-value {
  font-weight: 600;
  color: var(--text-primary);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.info-value.muted {
  color: var(--text-muted);
}

/* Card Footer & Action Button */
.card-footer {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  color: #ffffff;
  font-family: var(--font-accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 
    0 6px 20px rgba(0, 0, 0, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.20);
}

.action-btn:active {
  transform: scale(0.98);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
}

.card-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}

/* Quick Stats Grid (Mini Cards) */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.mini-card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-glass));
  -webkit-backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: 22px;
  overflow: hidden;
  padding: 18px 16px;
  box-shadow: 
    0 16px 40px rgba(0, 0, 0, 0.35),
    inset 0 1px 1px var(--border-highlight);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mini-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-icon {
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.mini-value {
  font-family: var(--font-accent);
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  margin-top: 3px;
}

.mini-subtext {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Quick Actions / Services Section (Refined Inset Glass Platter) */
.quick-actions-section {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sub-header-title {
  font-family: var(--font-accent);
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  padding-left: 4px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

.actions-plate {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-glass));
  -webkit-backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 
    0 14px 36px rgba(0, 0, 0, 0.3),
    inset 0 1px 1px var(--border-highlight);
}

.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}

.action-row:active {
  background: rgba(255, 255, 255, 0.07);
}

.action-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.action-row-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-row-label {
  font-family: var(--font-main);
  font-size: 13.5px;
  font-weight: 600;
  color: #f8fafc;
  letter-spacing: -0.01em;
}

.action-row-right {
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-chevron {
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, color 0.15s ease;
}

.action-row:active .action-chevron {
  color: #ffffff;
  transform: translateX(2px);
}

.action-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
  margin-left: 60px;
}

/* Tab-Specific Component Styles (Tariffs, Devices, Account) */
.plans-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.plan-card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-glass));
  -webkit-backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: 22px;
  overflow: hidden;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 
    0 14px 36px rgba(0, 0, 0, 0.3),
    inset 0 1px 1px var(--border-highlight);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.plan-card:active {
  transform: scale(0.98);
}

.plan-card.selected {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

.plan-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plan-title {
  font-family: var(--font-accent);
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.plan-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.plan-price-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.plan-price {
  font-family: var(--font-accent);
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
}

.plan-period {
  font-size: 11px;
  color: var(--text-muted);
}

/* Devices Tab Components: Empty State & Interactive Detail Card */
.empty-devices-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px;
}

.empty-device-icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.empty-device-title {
  font-family: var(--font-accent);
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.empty-device-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 320px;
  margin: 0 auto;
}

/* Detailed Device Card */
.device-detail-card {
  padding: 22px;
}

.device-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 18px;
}

.device-card-left {
  display: flex;
  align-items: center;
  gap: 13px;
  flex: 1;
}

.device-card-right {
  display: flex;
  align-items: center;
}

.device-name-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.device-name-view {
  display: flex;
  align-items: center;
  gap: 8px;
}

.device-title-text {
  font-family: var(--font-accent);
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.icon-edit-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-edit-btn:hover,
.icon-edit-btn:active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  transform: scale(0.94);
}

.device-name-edit {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rename-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 9px;
  padding: 5px 10px;
  font-family: var(--font-accent);
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  outline: none;
  flex: 1;
  max-width: 190px;
}

.rename-input:focus {
  border-color: var(--accent-cyan);
}

.rename-confirm-btn,
.rename-cancel-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.rename-confirm-btn {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.rename-cancel-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
}

.rename-confirm-btn:active,
.rename-cancel-btn:active {
  transform: scale(0.92);
}

.device-status-text {
  font-size: 13px;
  font-weight: 500;
  color: #34d399;
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}

.device-status-text.blocked,
#device-status-tag.blocked .device-status-text {
  color: #f87171;
}

.device-meta-rows {
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin-bottom: 20px;
}

.device-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
}

.meta-label {
  color: var(--text-secondary);
}

.meta-value {
  font-weight: 600;
  color: #ffffff;
}

.hwid-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.hwid-copy-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  padding: 9px 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.hwid-copy-pill:hover,
.hwid-copy-pill:active {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.22);
}

.hwid-code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.02em;
}

.hwid-copy-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.hwid-copy-pill:hover .hwid-copy-action {
  color: #ffffff;
}

.hwid-copy-pill.copied {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.09);
}

.hwid-copy-pill.copied .copy-hint-text,
.hwid-copy-pill.copied .hwid-copy-action,
.hwid-copy-pill.copied .hwid-copy-svg {
  color: #34d399;
  font-weight: 600;
}

.device-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.device-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 13px;
  border-radius: 14px;
  font-family: var(--font-accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.device-action-btn:active {
  transform: scale(0.97);
}

.btn-block {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.btn-block:active {
  background: rgba(255, 255, 255, 0.12);
}

.btn-block.is-blocked {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-delete {
  background: rgba(239, 68, 68, 0.09);
  border: 1px solid rgba(239, 68, 68, 0.22);
  color: #f87171;
}

.btn-delete:active {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.4);
}

.account-details-card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-glass));
  -webkit-backdrop-filter: blur(var(--blur-glass));
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  overflow: hidden;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 
    0 14px 36px rgba(0, 0, 0, 0.3),
    inset 0 1px 1px var(--border-highlight);
  margin-top: 14px;
}

/* Fixed Floating Pill Dockbar (Solid Opaque, No Transparency, Borderless) */
.dockbar {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 12px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: calc(100% - 32px);
  max-width: 400px;
  height: 64px;
  background: var(--bg-dock);
  border: none; /* без обводки */
  border-radius: 999px; /* пилл */
  padding: 0 10px;
  box-shadow: 
    0 16px 40px rgba(0, 0, 0, 0.7),
    0 4px 14px rgba(0, 0, 0, 0.4);
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  height: 100%;
  cursor: pointer;
  color: #707d93;
  transition: all 0.2s ease;
  position: relative;
  border-radius: 999px;
}

.dock-item:active {
  transform: scale(0.92);
}

.dock-item.active {
  color: #ffffff;
}

.dock-item.active .dock-icon {
  color: #ffffff;
  transform: translateY(-1px);
  animation: dockBounce 0.44s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes dockBounce {
  0% { transform: scale(0.82); }
  45% { transform: scale(1.20) translateY(-3px); }
  75% { transform: scale(0.97) translateY(0); }
  100% { transform: scale(1) translateY(-1px); }
}

.dock-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, color 0.2s ease;
}

.dock-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: color 0.2s ease, font-weight 0.2s ease;
}

.dock-item.active .dock-label {
  color: #ffffff;
  font-weight: 700;
}
