:root {
  --bg: #09090b;
  --panel: #141418;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #f0529b;
  --accent2: #8b5cf6;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 22px 20px 28px;
}
.wrap {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(165deg, #101014, #0b0b0e);
  padding: 18px;
  max-width: 1200px;
  margin: 0 auto;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.title {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.03em;
  font-weight: 800;
}
.sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 640px;
  line-height: 1.45;
}
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  background: #1a1a21;
  color: #fff;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: border-color 0.15s ease, opacity 0.15s ease;
}
.btn:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.18); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, rgba(240, 82, 155, 0.35), rgba(139, 92, 246, 0.28));
  border-color: rgba(240, 82, 155, 0.55);
}
.btn-ico { display: inline-block; line-height: 1; }
.btn[aria-busy="true"] .btn-ico { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.summary-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.summary-k { font-size: 12px; color: var(--muted); }
.summary-v { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.summary-item--ok .summary-v { color: var(--ok); }
.summary-item--warn .summary-v { color: var(--warn); }
.summary-item--muted .summary-v { color: #d4d4d8; }

.current-banner {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
  color: #d1fae5;
  font-size: 14px;
  line-height: 1.45;
}
.current-banner a {
  color: #6ee7b7;
  font-weight: 600;
  text-decoration: none;
}
.current-banner a:hover { text-decoration: underline; }

.tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.tab {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: #1a1a21;
  color: #fff;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab.active {
  background: linear-gradient(135deg, rgba(240, 82, 155, 0.3), rgba(139, 92, 246, 0.25));
  border-color: rgba(240, 82, 155, 0.55);
}
.tab-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}
.tab.active .tab-count {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.status-line {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}
.status-line.is-error {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}
.status-line.is-success {
  color: #bbf7d0;
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  min-height: 120px;
}
.card {
  border-radius: 14px;
  min-height: 340px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line);
  background: #17171d;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card--current {
  border-color: rgba(52, 211, 153, 0.45);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.12);
}
.card--deleted { opacity: 0.88; }
.card--deleted .cover,
.card--deleted .cover--ph { filter: grayscale(0.55) brightness(0.75); }

.card--empty,
.card--error {
  grid-column: 1 / -1;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  gap: 10px;
}
.empty-ico {
  font-size: 36px;
  line-height: 1;
  opacity: 0.55;
}
.empty-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.empty-desc {
  margin: 0;
  max-width: 420px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.skeleton {
  border-radius: 14px;
  min-height: 340px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, #17171d 0%, #22222a 50%, #17171d 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cover--ph {
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #2a2438, #15151b);
  display: grid;
  place-items: center;
  font-size: 42px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.35);
}
.overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.15) 55%);
}
.card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 15, 20, 0.75);
  backdrop-filter: blur(4px);
}
.badge--current { border-color: rgba(52, 211, 153, 0.5); color: var(--ok); }
.badge--deleted { border-color: rgba(248, 113, 113, 0.45); color: var(--danger); }
.badge--restorable { border-color: rgba(251, 191, 36, 0.45); color: var(--warn); }
.badge--inactive { border-color: rgba(161, 161, 170, 0.35); color: #d4d4d8; }
.card-meta {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
  z-index: 2;
}
.name {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.meta-line {
  margin-top: 6px;
  color: #d4d4d8;
  font-size: 14px;
  line-height: 1.35;
}
.meta-line--muted { color: var(--muted); font-size: 13px; }
.meta-line--note { color: #a8a8b3; font-size: 12px; font-style: italic; }
.card-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.card-actions .btn { font-size: 13px; padding: 6px 12px; }
.bottom { margin-top: 16px; }
.hint { color: var(--muted); font-size: 14px; line-height: 1.5; }

.enc-dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  background: #121218;
  color: var(--text);
  max-width: 420px;
  width: calc(100% - 32px);
}
.enc-dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
.enc-dialog-inner { padding: 18px; }
.enc-dialog-title { margin: 0 0 10px; font-size: 20px; }
.enc-dialog-body { margin: 0 0 8px; color: #d4d4d8; line-height: 1.5; }
.enc-dialog-note {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.enc-dialog-foot { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 640px) {
  body { padding: 14px 12px 20px; }
  .wrap { padding: 14px; border-radius: 14px; }
  .summary-bar { gap: 8px; }
  .summary-item { flex: 1 1 calc(50% - 8px); justify-content: space-between; }
}
