/* ============================================================
   LK LAYOUT — sidebar + content + mobile tabbar
   Safe22 Personal Cabinet
   ============================================================ */

/* ── Reset for LK body ── */
body.lk-body {
  margin: 0;
  padding: 0;
  background: #f4f6f5;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ── Layout shell ── */
.lk-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.lk-sidebar {
  width: 260px;
  min-height: 100vh;
  background: #fff;
  border-right: 1px solid #e8edec;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 2px 0 16px rgba(0,0,0,.04);
}

/* Logo */
.lk-sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid #f0f4f3;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}
.lk-sidebar-logo-name {
  font-size: 18px;
  font-weight: 700;
  color: #1d1d1f;
  letter-spacing: -.03em;
}
.lk-sidebar-logo-tag {
  font-size: 10px;
  font-weight: 600;
  background: #e8f5f2;
  color: #1e5a4d;
  border-radius: 6px;
  padding: 2px 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Nav */
.lk-sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.lk-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  color: #5a6a65;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  margin-bottom: 2px;
  position: relative;
}
.lk-nav-item:hover {
  background: #f4f8f7;
  color: #1d1d1f;
}
.lk-nav-item.active {
  background: #e8f5f2;
  color: #1e5a4d;
  font-weight: 600;
}
.lk-nav-item.active .lk-nav-icon {
  color: #2f8f7a;
}
.lk-nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #8fa09a;
  transition: color .15s;
  display: flex;
  align-items: center;
}
.lk-nav-item:hover .lk-nav-icon { color: #2f8f7a; }
.lk-nav-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.lk-nav-subtitle {
  font-size: 10px;
  font-weight: 400;
  color: #a0b4ae;
  letter-spacing: 0;
}
.lk-nav-item.active .lk-nav-subtitle { color: #5a9e8f; }
.lk-nav-separator {
  height: 1px;
  background: #f0f4f3;
  margin: 6px 12px;
}

/* Sub-items */
.lk-nav-sub {
  padding-left: 44px;
  margin-bottom: 2px;
}
.lk-nav-sub-item {
  display: block;
  padding: 7px 12px;
  border-radius: 8px;
  color: #7a8c87;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background .12s, color .12s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.lk-nav-sub-item:hover {
  background: #f4f8f7;
  color: #1d1d1f;
}
.lk-nav-sub-item.active {
  color: #2f8f7a;
  font-weight: 600;
}

/* User block at bottom */
.lk-sidebar-bottom {
  flex-shrink: 0;
  border-top: 1px solid #f0f4f3;
}
.lk-sidebar-bottom .lk-nav-item {
  margin: 0;
  border-radius: 0;
  border-bottom: 1px solid #f0f4f3;
}
.lk-sidebar-user {
  padding: 14px 16px;
  border-top: none;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.lk-sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e8f5f2;
  color: #2f8f7a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.lk-sidebar-user-info {
  flex: 1;
  min-width: 0;
}
.lk-sidebar-email {
  font-size: 12px;
  color: #1d1d1f;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lk-sidebar-partner-cta {
  display: block;
  font-size: 12px;
  color: #2f8f7a;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 2px;
  transition: color .15s;
  text-align: left;
}
.lk-sidebar-partner-cta:hover { color: #1d6f5e; }
.lk-sidebar-logout {
  font-size: 12px;
  color: #9aaeaa;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  transition: color .15s;
}
.lk-sidebar-logout:hover { color: #e55; }

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.lk-main {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.lk-topbar {
  display: none; /* hidden on desktop */
}

.lk-content {
  flex: 1;
  padding: 32px 40px 48px;
  width: 100%;
  box-sizing: border-box;
}

/* 2-column layout for wide sections on desktop */
.lk-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}
.lk-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 1100px) {
  .lk-grid-2 { grid-template-columns: 1fr; }
  .lk-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .lk-grid-3 { grid-template-columns: 1fr; }
}

/* Section title */
.lk-section-title {
  font-size: 22px;
  font-weight: 700;
  color: #1d1d1f;
  letter-spacing: -.02em;
  margin: 0 0 20px;
}

/* Card in LK */
.lk-card {
  background: #fff;
  border: 1px solid #e8edec;
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,.03);
}

/* Status pill */
.lk-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}
.lk-status-pill--active { background: #dcfce7; color: #15803d; }
.lk-status-pill--warning { background: #fef3c7; color: #d97706; }
.lk-status-pill--inactive { background: #f1f5f9; color: #64748b; }

/* ── More sheet (mobile overlay) ── */
.lk-more-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.lk-more-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.lk-more-sheet {
  background: #fff;
  border-radius: 20px 20px 0 0;
  width: 100%;
  padding: 16px 16px 24px;
  transform: translateY(100%);
  transition: transform .25s ease;
}
.lk-more-overlay.open .lk-more-sheet {
  transform: translateY(0);
}
.lk-more-sheet-handle {
  width: 40px;
  height: 4px;
  background: #e2e8e6;
  border-radius: 2px;
  margin: 0 auto 16px;
}
.lk-more-sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 8px;
  border-radius: 12px;
  color: #1d1d1f;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-bottom: 1px solid #f4f6f5;
}
.lk-more-sheet-item:last-child { border-bottom: none; }
.lk-more-sheet-item:hover { background: #f4f8f7; }
.lk-more-sheet-icon {
  width: 40px;
  height: 40px;
  background: #f4f8f7;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2f8f7a;
  flex-shrink: 0;
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .lk-sidebar { display: none; }

  .lk-main {
    margin-left: 0;
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .lk-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    padding-top: calc(14px + env(safe-area-inset-top));
    background: #fff;
    border-bottom: 1px solid #f0f4f3;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .lk-topbar-logo {
    font-size: 17px;
    font-weight: 700;
    color: #1d1d1f;
    letter-spacing: -.03em;
    text-decoration: none;
  }
  .lk-topbar-section {
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
  }
  .lk-topbar-logout {
    font-size: 13px;
    color: #9aaeaa;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
  }

  .lk-content {
    padding: 20px 16px 24px;
    max-width: 100%;
  }
  .lk-section-title {
    font-size: 18px;
    margin-bottom: 16px;
  }

  /* Bottom tab bar */
  .lk-tabbar {
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    height: calc(60px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid #e8edec;
    display: flex;
    align-items: flex-start;
    padding-top: 8px;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 200;
    box-shadow: 0 -2px 16px rgba(0,0,0,.06);
  }
  .lk-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0 4px;
    color: #a0b0aa;
    font-size: 10px;
    font-weight: 500;
    transition: color .15s;
    text-decoration: none;
  }
  .lk-tab.active {
    color: #2f8f7a;
  }
  .lk-tab-icon {
    width: 24px;
    height: 24px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .lk-tab-dot {
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #2f8f7a;
    opacity: 0;
    transition: opacity .15s;
  }
  .lk-tab.active .lk-tab-dot { opacity: 1; }
}

@media (min-width: 769px) {
  .lk-tabbar { display: none !important; }
}

/* ============================================================
   PARTNER SECTION CARDS
   ============================================================ */
.lk-partner-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.lk-partner-stat {
  background: #f8faf9;
  border: 1px solid #e8edec;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}
.lk-partner-stat-val {
  font-size: 22px;
  font-weight: 700;
  color: #1d1d1f;
  letter-spacing: -.02em;
}
.lk-partner-stat-lbl {
  font-size: 12px;
  color: #7a8c87;
  margin-top: 4px;
}
@media (max-width: 500px) {
  .lk-partner-stats { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   COPY ROW
   ============================================================ */
.lk-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8faf9;
  border: 1px solid #e8edec;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 10px;
}
.lk-copy-val {
  flex: 1;
  font-size: 14px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: #1d1d1f;
  word-break: break-all;
}
.lk-copy-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid #d0dbd8;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #2f8f7a;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.lk-copy-btn:hover { background: #e8f5f2; }

/* ============================================================
   GUIDE TYPE SELECTOR (card grid)
   ============================================================ */
.lk-guide-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  .lk-guide-tabs { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  .lk-guide-tabs { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

/* Guide steps grid */
.lk-guide-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 700px) {
  .lk-guide-steps { grid-template-columns: 1fr; }
}

/* ============================================================
   SECTION SUB-NAV (e.g. Subscription tabs)
   ============================================================ */
.lk-subnav {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: #f0f4f3;
  border-radius: 12px;
  padding: 4px;
}
.lk-subnav-btn {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: none;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: #7a8c87;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.lk-subnav-btn.active {
  background: #fff;
  color: #1d1d1f;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* VPN shop grid in ЛК — matches store.html sp-grid layout */
.sp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1024px) { .sp-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .sp-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
@media (max-width: 400px)  { .sp-grid { grid-template-columns: 1fr; } }
