/* ── Reset & Tokens ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-page-bg:        #f7f5ff;
  --color-surface:        #ffffff;
  --color-surface-subtle: #faf8ff;
  --color-surface-inset:  #f0ecfd;
  --color-border:         #e2dcf8;
  --color-border-subtle:  #eee9fc;
  --color-border-input:   #ddd6f8;
  --color-brand:          #6c4fc4;
  --color-brand-light:    #ede9fc;
  --color-brand-muted:    #c4b5f7;
  --color-text-heading:   #2d1f6e;
  --color-text-body:      #3d3060;
  --color-text-secondary: #8b82b8;
  --color-text-muted:     #a099c8;
  --color-text-faint:     #c4bde8;
  --color-rank-1:         #c4a84f;
  --color-rank-2:         #b0b8c4;
  --color-rank-3:         #c49a6c;
  --color-rank-default:   #ddd6f8;
  --color-code-bg:        #ede9fc;
  --color-code-text:      #6c4fc4;
  --color-cowork-bg:      #e8f5ee;
  --color-cowork-text:    #1a7a4a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--color-page-bg);
  color: var(--color-text-body);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-brand); text-decoration: none; }

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  height: 52px;
  background: var(--color-surface);
  border-bottom: 0.5px solid var(--color-border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-mark {
  width: 28px;
  height: 28px;
  background: var(--color-brand-light);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-brand);
  flex-shrink: 0;
}

.logo-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-heading);
}

.back-link {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--color-text-secondary);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.1s;
}

.back-link:hover {
  color: var(--color-brand);
}

/* ── Page wrapper ────────────────────────────────────────────────────────── */
.page-wrapper {
  max-width: 660px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Certificate Card (large) ────────────────────────────────────────────── */
.cert-card {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: 14px;
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.cert-card-rank-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.cert-card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.cert-card-emblem {
  font-size: 10px;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
}

.cert-card-actions {
  display: flex;
  gap: 8px;
}

.cert-card-actions button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-faint);
  font-size: 20px;
  padding: 5px;
  border-radius: 5px;
  transition: color 0.1s, background 0.1s;
  line-height: 1;
}

.cert-card-actions button:hover {
  color: var(--color-brand);
  background: var(--color-surface-inset);
}

.cert-card-name {
  font-size: 26px;
  font-weight: 500;
  color: var(--color-text-heading);
  margin-bottom: 12px;
  line-height: 1.3;
}

.cert-card-count-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

.cert-card-count {
  font-size: 40px;
  font-weight: 500;
  color: var(--color-brand);
  line-height: 1;
}

.cert-card-count-label {
  font-size: 14px;
  color: var(--color-text-muted);
}

.cert-card-since {
  font-size: 11px;
  color: var(--color-text-faint);
  margin-bottom: 14px;
}

.cert-card-progress-track {
  background: var(--color-surface-inset);
  border-radius: 99px;
  height: 3px;
  overflow: hidden;
  margin-bottom: 5px;
}

.cert-card-progress-fill {
  background: var(--color-brand-muted);
  border-radius: 99px;
  height: 100%;
  transition: width 0.5s ease;
}

.cert-card-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-text-faint);
  margin-top: 5px;
}

/* ── Section Title ───────────────────────────────────────────────────────── */
.section-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

/* ── Task List (card style) ──────────────────────────────────────────────── */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 2rem;
}

.task-item {
  background: var(--color-surface);
  border: 0.5px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: box-shadow 0.15s;
}

.task-item:hover {
  box-shadow: 0 2px 12px rgba(108,79,196,0.08);
}

.task-item-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-brand-muted);
  background: var(--color-brand-light);
  border-radius: 6px;
  min-width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.task-item-body {
  flex: 1;
  min-width: 0;
}

.task-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-heading);
  margin-bottom: 4px;
  line-height: 1.3;
}

.task-item-context {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.55;
  margin-bottom: 10px;
}

.task-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}

.tag i { font-size: 12px; }

.tag-date {
  background: var(--color-surface-inset);
  color: var(--color-text-muted);
  border: 0.5px solid var(--color-border-subtle);
}

.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}

.tool-badge i { font-size: 12px; }

.tool-badge-code {
  background: var(--color-code-bg);
  color: var(--color-code-text);
}

.tool-badge-cowork {
  background: var(--color-cowork-bg);
  color: var(--color-cowork-text);
}

.tool-badge-default {
  background: var(--color-surface-inset);
  color: var(--color-text-muted);
}

/* ── Not found ───────────────────────────────────────────────────────────── */
.not-found {
  text-align: center;
  padding: 4rem 1rem;
}

.not-found h2 {
  font-size: 18px;
  font-weight: 500;
  color: var(--color-text-heading);
  margin-bottom: 8px;
}

.not-found p {
  color: var(--color-text-muted);
  font-size: 14px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .page-wrapper { padding: 1.25rem 1rem; }
  .topbar { padding: 0 1rem; }
  .cert-card { padding: 1.25rem; }
  .cert-card-name { font-size: 20px; }
  .cert-card-count { font-size: 32px; }
  .task-item { padding: 0.9rem 1rem; gap: 0.75rem; }
  .task-item-title { font-size: 13px; }
  .task-item-context { font-size: 11.5px; }
}
