:root {
  --auth-primary: #6366f1;
  --auth-primary-2: #8b5cf6;
  --auth-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

/* ---------- 侧边栏 ---------- */
.auth-sidebar {
  background: linear-gradient(180deg, #14162b 0%, #1b1f3a 100%) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.auth-sidebar .navbar-brand {
  padding: 1rem 1.25rem;
}
.auth-brand .brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--auth-gradient);
  color: #fff;
  font-size: 1.2rem;
  margin-right: 0.6rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}
.auth-brand .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}
.auth-brand .brand-text small {
  color: rgba(255, 255, 255, 0.55);
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}
.auth-sidebar .nav-link,
.auth-offcanvas .nav-link {
  color: rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  margin: 2px 8px;
  padding: 0.55rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  transition: all 0.15s;
}
.auth-sidebar .nav-link:hover,
.auth-offcanvas .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.auth-sidebar .nav-link.active,
.auth-offcanvas .nav-link.active {
  color: #fff;
  background: var(--auth-gradient);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}
.sidebar-footer {
  padding: 1rem 1.25rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ---------- 手机抽屉导航 ---------- */
.auth-offcanvas {
  background: linear-gradient(180deg, #14162b 0%, #1b1f3a 100%) !important;
  width: 280px !important;
}
.offcanvas-user {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.9rem 0.4rem 1rem;
}
.offcanvas-user .text-white-50 {
  color: rgba(255, 255, 255, 0.5);
}
.auth-offcanvas .btn-outline-light:hover {
  color: #fff;
}

/* ---------- 顶栏 ---------- */
.auth-topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--tblr-border-color);
}
.auth-avatar {
  background: var(--auth-gradient) !important;
  color: #fff !important;
  font-weight: 700;
}

/* ---------- 统计卡片 ---------- */
.stat-card {
  border: 1px solid var(--tblr-border-color);
  border-radius: 14px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
}
.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  font-size: 1.5rem;
}
.stat-value {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 0.82rem;
  margin-top: 2px;
}

/* ---------- 表格 ---------- */
.card-table th {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--tblr-muted-color);
  background: var(--tblr-bg-surface-tertiary);
}
.card-table td {
  vertical-align: middle;
}
.table-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-end;
}

/* ---------- 授权码手机卡片 ---------- */
.lic-card {
  position: relative;
  border: 1px solid var(--tblr-border-color);
  border-left-width: 4px;
  border-radius: 12px;
  background: var(--tblr-bg-surface);
  padding: 0.85rem 0.95rem;
  transition: box-shadow 0.15s;
}
.lic-card:active {
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.1);
}
.lic-card.st-active { border-left-color: #2fb344; }
.lic-card.st-expiring { border-left-color: #f76707; }
.lic-card.st-disabled { border-left-color: #d63939; }
.lic-card.st-expired { border-left-color: #99a6b8; }
.lic-key {
  font-family: var(--tblr-font-monospace);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.lic-meta {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1rem;
  row-gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--tblr-secondary);
}
.lic-progress {
  height: 5px;
  border-radius: 99px;
  background: var(--tblr-bg-surface-tertiary);
  overflow: hidden;
}
.lic-progress > div {
  height: 100%;
  border-radius: 99px;
  background: var(--auth-gradient);
}
.lic-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.lic-actions .btn {
  padding-inline: 0.65rem;
}

/* ---------- 日志手机列表流 ---------- */
.log-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.25rem;
  border-bottom: 1px solid var(--tblr-border-color);
}
.log-item:last-child {
  border-bottom: none;
}

/* ---------- 登录页 ---------- */
.auth-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 600px at 20% 10%, #3b3f8f 0%, transparent 55%),
              radial-gradient(1000px 500px at 85% 90%, #6d28d9 0%, transparent 50%),
              linear-gradient(135deg, #0f1229 0%, #1a1d3d 60%, #101230 100%);
  padding: 1rem;
}
.auth-login-card {
  width: 100%;
  max-width: 400px;
}
.auth-login-inner {
  border-radius: 18px;
  overflow: hidden;
}
.auth-login-inner .card-body {
  padding: 2.25rem 2.5rem 2.5rem;
}
.auth-login-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--auth-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
}
.auth-field-label {
  font-size: 0.8rem !important;
  font-weight: 500;
  color: var(--tblr-secondary);
  margin-bottom: 0.35rem;
}
.auth-input {
  height: 42px;
  font-size: 15px;
  border-radius: 9px;
}
.auth-input::placeholder {
  font-size: 13.5px;
  color: #a8b0ba;
}
.auth-input:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.auth-login-btn {
  height: 44px;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  border-radius: 10px;
}
.auth-btn-gradient {
  background: var(--auth-gradient) !important;
  border: none !important;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
  transition: filter 0.15s, transform 0.15s;
}
.auth-btn-gradient:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.captcha-box {
  min-width: 132px;
  height: 42px;
  border-radius: 9px;
  overflow: hidden;
  display: flex;
  align-items: center;
  cursor: pointer;
  border: 1px solid var(--tblr-border-color);
}
.captcha-box svg {
  display: block;
}

/* ---------- 自定义确认框 ---------- */
.modal-sm-confirm {
  max-width: 340px;
}
.confirm-content {
  border: none;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(17, 24, 39, 0.25);
}
.confirm-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(214, 57, 57, 0.1);
  color: #d63939;
}

/* ---------- 深色主题 ---------- */
[data-bs-theme="dark"] .auth-topbar {
  background: rgba(24, 27, 46, 0.85);
}
[data-bs-theme="dark"] .auth-sidebar,
[data-bs-theme="dark"] .auth-offcanvas {
  background: linear-gradient(180deg, #0d0f1e 0%, #12142a 100%) !important;
}

/* ---------- 杂项 ---------- */
.code-key {
  font-family: var(--tblr-font-monospace);
  background: var(--tblr-bg-surface-tertiary);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}
pre.bg-dark {
  background: #151a30 !important;
}
.min-w-0 {
  min-width: 0;
}

/* ============================================================
   移动端适配 (<992px 与触控优化)
   ============================================================ */

/* 筛选栏输入框: 去固定宽度自适应 */
@media (max-width: 991.98px) {
  .card-header form input.form-control-sm,
  .card-header form select.form-select-sm {
    width: auto !important;
    flex: 1 1 130px;
    min-width: 0;
  }
  .card-header form {
    width: 100%;
  }
}

/* 触控目标与字号 (防 iOS 聚焦缩放) */
@media (max-width: 767.98px) {
  body {
    -webkit-text-size-adjust: 100%;
  }
  .btn-sm {
    --bs-btn-padding-y: 0.42rem;
    --bs-btn-padding-x: 0.7rem;
    --bs-btn-font-size: 0.85rem;
  }
  .form-control, .form-select {
    font-size: 16px;
  }
  .form-control-sm, .form-select-sm {
    font-size: 14px !important;
  }
  .stat-value {
    font-size: 1.25rem;
  }
  .stat-icon {
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
  }
  .page-title {
    font-size: 1.05rem;
  }
  .modal-body {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .footer {
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
  }
  .toast-container {
    left: 1rem;
    right: 1rem;
  }
  .toast {
    width: 100% !important;
    max-width: none !important;
  }
}

/* 全屏弹窗吸底操作栏 */
@media (max-width: 575.98px) {
  .modal-fullscreen-sm-down > .modal-content {
    border-radius: 0;
  }
  .modal-fullscreen-sm-down > .modal-content > .modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--tblr-bg-surface);
    border-top: 1px solid var(--tblr-border-color);
    margin-top: auto;
  }
  .modal-fullscreen-sm-down > .modal-content {
    display: flex;
    flex-direction: column;
    min-height: 100%;
  }
}