:root {
  color-scheme: light;
  --gradient-start: #f7f9ff;
  --gradient-end: #eef4ff;
  --card-bg: #ffffff;
  --card-border: rgba(102, 126, 234, 0.18);
  --shadow-soft: 0 18px 40px -22px rgba(95, 126, 234, 0.6);
}

body {
  background: linear-gradient(160deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #1f2440;
}

.front-wrapper {
  min-height: 100vh;
  padding-bottom: 4rem;
}

.admin-wrapper {
  min-height: calc(100vh - 4rem);
}

.admin-card {
  border-radius: 1.25rem;
  border: 1px solid rgba(99, 102, 241, 0.12);
  box-shadow: 0 18px 45px -28px rgba(79, 70, 229, 0.45);
  display: flex;
  flex-direction: column;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-form textarea {
  min-height: 190px;
}

.admin-wrapper table tr td,
.admin-wrapper table tr th {
  border-color: rgba(226, 232, 240, 0.7);
}

.admin-card .card-body {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.recent-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.recent-scroll {
  max-height: 340px;
  overflow-y: auto;
  border-radius: 0.75rem;
  border: 1px solid rgba(226, 232, 240, 0.7);
}

.recent-scroll table {
  margin-bottom: 0;
}

.recent-scroll::-webkit-scrollbar {
  width: 6px;
}

.recent-scroll::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.35);
  border-radius: 999px;
}

.recent-section:last-child {
  margin-bottom: 0;
}

.hero-title {
  font-size: clamp(1.6rem, 2.4vw, 2rem);
  font-weight: 700;
  color: #1f2440;
}

.hero {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(56, 189, 248, 0.08));
  border: 1px solid var(--card-border);
  border-radius: 1.1rem;
  padding: 0.85rem 1.4rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 2rem;
}

.hero-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: nowrap;
}

.hero-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex: 0 0 auto;
}

.hero-btn {
  background: linear-gradient(135deg, #6366f1, #60a5fa);
  color: #ffffff;
  border: none;
  font-weight: 600;
  box-shadow: 0 12px 28px -18px rgba(79, 70, 229, 0.8);
}

.hero-btn:hover {
  color: #ffffff;
  filter: brightness(1.05);
}

.hero-stats {
  display: flex;
  gap: 0.8rem;
  flex-wrap: nowrap;
  align-items: center;
}

.hero-stat {
  min-width: 110px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(99, 102, 241, 0.1);
  border-radius: 0.85rem;
  padding: 0.6rem 0.9rem;
  box-shadow: 0 10px 20px -26px rgba(99, 102, 241, 0.9);
}

.hero-stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: #4338ca;
}

.hero-stat-label {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.1rem;
}

.hero-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  align-self: flex-end;
}

.date-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

.date-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 45px -24px rgba(56, 130, 246, 0.75);
}

.date-card .card-body {
  padding: 1.75rem;
}

.badge-count {
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.accordion-button {
  border-radius: 0.85rem !important;
  font-weight: 600;
  color: #1f2440;
}

.accordion-button:not(.collapsed) {
  color: #4338ca;
  background-color: rgba(79, 70, 229, 0.12);
  box-shadow: none;
}

.accordion-item {
  border-radius: 1rem !important;
  border: none;
  background-color: transparent;
}

.entry-card {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 1.1rem;
}

.entry-card .accordion-body {
  padding: 1.5rem;
}

.entry-card pre {
  background: rgba(239, 246, 255, 0.8);
  border-radius: 0.85rem;
  padding: 1rem;
  font-size: 0.95rem;
  white-space: pre-wrap;
}

.entry-content {
  max-height: 220px;
  overflow-y: auto;
  position: relative;
  scrollbar-width: thin;
}

.entry-content::-webkit-scrollbar {
  width: 6px;
}

.entry-content::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.45);
  border-radius: 999px;
}

.copy-btn {
  white-space: nowrap;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.45rem 1.4rem;
  box-shadow: 0 12px 30px -15px rgba(79, 70, 229, 0.8);
}

.copy-btn.btn-primary {
  background: linear-gradient(135deg, #6366f1, #60a5fa);
  border: none;
}

.copy-btn.btn-primary:hover {
  filter: brightness(1.05);
}

.card-footer-link {
  color: #6366f1;
  font-weight: 600;
  text-decoration: none;
}

.card-footer-link:hover {
  text-decoration: underline;
}

.hero-compact {
  padding: 1.25rem 1.65rem;
  border-radius: 1.1rem;
}

.hero-compact-main {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.card-table-scroll {
  max-height: 520px;
  overflow-y: auto;
  border-radius: 0.75rem;
  border: 1px solid rgba(226, 232, 240, 0.7);
}

.card-table-scroll::-webkit-scrollbar {
  width: 6px;
}

.card-table-scroll::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 999px;
}

.note-form .form-control {
  background: rgba(255, 255, 255, 0.9);
}

.note-form .note-input {
  min-width: 140px;
  flex: 0 1 50%;
  max-width: 220px;
}

.note-form.note-saving .note-input {
  border-color: #f59e0b;
}

.note-form.note-saved .note-input {
  border-color: #22c55e;
}

.note-form.note-error .note-input {
  border-color: #ef4444;
}

@media (max-width: 768px) {
  .note-form .note-input {
    flex-basis: 100%;
    max-width: 100%;
  }
}

.event-scroll {
  max-height: 560px;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.event-scroll::-webkit-scrollbar {
  width: 6px;
}

.event-scroll::-webkit-scrollbar-thumb {
  background: rgba(14, 165, 233, 0.35);
  border-radius: 999px;
}

.event-pill {
  background: rgba(79, 70, 229, 0.12);
  color: #4338ca;
}

.event-pill-script_open {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
}

.event-pill-cloud_fetch {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.event-pill-auto_fetch {
  background: rgba(234, 179, 8, 0.16);
  color: #92400e;
}

.event-pill-monitor_start {
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
}

.event-pill-custom {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
}

.cards-dashboard {
  max-width: 80%;
}

.card-fill {
  min-height: 100%;
}

.min-w-120 {
  min-width: 120px;
}

.min-w-150 {
  min-width: 150px;
}

.min-w-160 {
  min-width: 160px;
}

@media (max-width: 768px) {
  .hero {
    padding: 0.85rem 1.1rem;
  }
  .hero-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }
  .hero-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .hero-stats {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: space-between;
  }
  .hero-stat {
    flex: 1 1 50%;
  }
  .hero-btn {
    width: 100%;
    text-align: center;
  }
  .hero-toggle {
    align-self: flex-end;
  }
  .hero[data-collapsed="true"] .hero-actions {
    display: none;
  }

  .date-card .card-body {
    padding: 1.4rem;
  }
}
/* 针对卡密管理页面的右侧列 - 保持80vh固定高度 */
.admin-wrapper .col-12.col-xxl-4 {
  height: 70vh;
  display: flex;
  flex-direction: column;
}

.admin-wrapper .col-12.col-xxl-4 .admin-card {
  height: 100%;
}

.admin-wrapper .event-scroll {
  max-height: none !important;
  height: calc(100% - 60px);
  flex: 1;
  min-height: 400px;
}

/* 针对前台页面的列 - 移除固定高度，让内容自适应 */
.front-wrapper .col-12.col-lg-6.col-xxl-4 {
  /* 移除 height: 40vh; */
  display: block; /* 改为 block 而不是 flex */
  margin-bottom: 1.5rem;
}

.front-wrapper .col-12.col-lg-6.col-xxl-4 .date-card {
  /* 移除固定高度，让卡片根据内容自适应 */
  height: auto;
  min-height: auto;
}

.front-wrapper .col-12.col-lg-6.col-xxl-4 .card-body {
  /* 移除 flex 相关属性 */
  display: block;
  overflow: visible;
}

/* 确保卡密管理页面的左侧列保持固定高度 */
.admin-wrapper .col-12.col-xxl-8 {
  height: 70vh;
  display: flex;
  flex-direction: column;
}

.admin-wrapper .col-12.col-xxl-8 .admin-card {
  height: 100%;
}

.admin-wrapper .card-table-scroll {
  max-height: none !important;
  height: calc(100% - 60px);
  flex: 1;
  min-height: 400px;
}

/* 响应式调整 - 主要针对管理页面 */
@media (max-width: 1200px) {
  .admin-wrapper .col-12.col-xxl-4,
  .admin-wrapper .col-12.col-xxl-8 {
    height: auto;
    min-height: 500px;
  }
}

/* 如果需要，可以为前台卡片添加最大高度限制，但不要固定高度 */
.front-wrapper .date-card {
  max-height: 600px; /* 可选：设置一个最大高度防止卡片过大 */
  overflow-y: auto; /* 如果内容过多，允许滚动 */
}

.front-wrapper .accordion {
  max-height: 400px; /* 限制手风琴区域的最大高度 */
  overflow-y: auto;
}
