/*
 * LinsGeek ERP —— 套餐信息：右侧悬浮按钮 + 贴着按钮弹出的套餐卡片（配合 22-side-plan.js）
 * 只有脚本确认接管之后（body.lg-plan-side）才收起页头的徽章，脚本没生效时原徽章照常可用。
 * 卡片的外观和帮助卡片（21-side-help.css）是一套。
 */

/* 页头头像旁边的套餐徽章：收起（仍在 DOM 里） */
body.lg-plan-side #app header > ul > li:has(.header-package-trigger) { display: none !important; }

/* ---------- 悬浮按钮 ---------- */
.layout-right-quick-actions .lg-plan-btn {
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; color: #0d7b6d; cursor: pointer;
}
.layout-right-quick-actions .lg-plan-btn img { width: 24px; height: 24px; object-fit: contain; display: block; }
.layout-right-quick-actions .lg-plan-btn svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
/* 打开时：加一圈描边表示"已按下"（徽章是图片，不能像帮助按钮那样反色） */
.layout-right-quick-actions .lg-plan-btn.is-on { box-shadow: 0 0 0 2px #0d7b6d, 0 4px 12px rgba(13, 123, 109, .25) !important; }

/* ---------- 套餐卡片 ---------- */
#lg-plan-pop {
  --lg-arrow-y: 50%;
  position: fixed; z-index: 1000; top: 0; right: 64px;
  width: 440px; max-width: calc(100vw - 88px);
  display: flex; flex-direction: column;
  background: #fff; color: #1f2a37;
  border: 1px solid #e3e8ee; border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 35, 52, .16), 0 2px 8px rgba(15, 35, 52, .06);
  font-size: 13px; line-height: 1.45;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateX(10px) scale(.98); transform-origin: right var(--lg-arrow-y);
  transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
}
#lg-plan-pop.is-open {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity .16s ease, transform .16s ease;
}
#lg-plan-pop::after {
  content: ""; position: absolute; right: -7px; top: var(--lg-arrow-y);
  width: 12px; height: 12px; margin-top: -6px;
  background: #fff; border: 1px solid #e3e8ee; border-left: 0; border-bottom: 0;
  transform: rotate(45deg); border-top-right-radius: 3px;
}

/* 头部：徽章 + 套餐名 + 剩余天数 / 时区 */
#lg-plan-pop .lg-plan-hd {
  display: flex; align-items: flex-start; gap: 12px; flex: none;
  padding: 14px 12px 14px 16px;
  background: linear-gradient(135deg, #eef8f6 0%, #fff 70%);
  border-bottom: 1px solid #eef1f4; border-radius: 14px 14px 0 0;
}
#lg-plan-pop .lg-plan-hd img { width: 40px; height: 40px; object-fit: contain; flex: none; }
#lg-plan-pop .lg-plan-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#lg-plan-pop .lg-plan-id strong { font-size: 16px; font-weight: 700; color: #111827; }
#lg-plan-pop .lg-plan-id span { font-size: 12px; color: #5b6676; }
#lg-plan-pop .lg-plan-x {
  width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: #6b7280; cursor: pointer;
}
#lg-plan-pop .lg-plan-x:hover { background: rgba(15, 35, 52, .06); color: #111827; }
#lg-plan-pop .lg-plan-x svg,
#lg-plan-pop .lg-plan-ft svg {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

/* 四项额度：两列 */
#lg-plan-pop .lg-plan-bd {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px 16px;
}
#lg-plan-pop .lg-plan-q {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 10px; border: 1px solid #eef1f4; border-radius: 10px; background: #fbfcfd;
}
#lg-plan-pop .lg-plan-ring { position: relative; width: 46px; height: 46px; flex: none; color: #0d7b6d; }
#lg-plan-pop .lg-plan-ring.is-high { color: #d98a1f; }
#lg-plan-pop .lg-plan-ring.is-full { color: #d9443f; }
#lg-plan-pop .lg-plan-ring svg { width: 46px; height: 46px; transform: rotate(-90deg); display: block; }
#lg-plan-pop .lg-plan-ring circle { fill: none; stroke-width: 4.5; }
#lg-plan-pop .lg-plan-ring .t { stroke: #e8edf1; }
#lg-plan-pop .lg-plan-ring .p { stroke: currentColor; stroke-linecap: round; }
#lg-plan-pop .lg-plan-ring b {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
#lg-plan-pop .lg-plan-qt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
#lg-plan-pop .lg-plan-qt strong { font-size: 13px; font-weight: 700; color: #111827; overflow-wrap: anywhere; }
#lg-plan-pop .lg-plan-qt span { font-size: 12px; color: #5b6676; overflow-wrap: anywhere; }

/* 底部："我的套餐" */
#lg-plan-pop .lg-plan-ft { flex: none; padding: 0 16px 14px; }
#lg-plan-pop .lg-plan-ft button {
  display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; min-height: 36px;
  padding: 6px 12px; border: 0; border-radius: 9px;
  background: #0d7b6d; color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
#lg-plan-pop .lg-plan-ft button:hover { background: #0a6659; }
#lg-plan-pop .lg-plan-ft svg { width: 16px; height: 16px; }

/* 宽屏但悬浮按钮组收进了抽屉（汉堡菜单模式）：停在右下角，不画箭头 */
#lg-plan-pop.is-corner {
  top: auto; right: 16px; bottom: 16px; max-height: calc(100vh - 32px);
  max-width: calc(100vw - 32px); transform-origin: right bottom;
}
#lg-plan-pop.is-corner::after { display: none; }

/* 手机宽度：从底部升起的面板，额度单列 */
#lg-plan-pop.is-sheet {
  left: 0; right: 0; top: auto; bottom: 0; width: auto; max-width: none; max-height: 82vh;
  border-radius: 16px 16px 0 0; border-width: 1px 0 0;
  box-shadow: 0 -12px 40px rgba(15, 35, 52, .22);
  transform: translateY(24px); transform-origin: center bottom;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
#lg-plan-pop.is-sheet.is-open { transform: none; }
#lg-plan-pop.is-sheet::after { display: none; }
#lg-plan-pop.is-sheet .lg-plan-hd { border-radius: 16px 16px 0 0; }
#lg-plan-pop.is-sheet .lg-plan-ft button { min-height: 44px; font-size: 14px; }
@media (max-width: 420px) {
  #lg-plan-pop.is-sheet .lg-plan-bd { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  #lg-plan-pop, #lg-plan-pop.is-open { transition: none; }
}
