:root {
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --color-bg: #fafafa;
  --color-text: #111;
  --color-text-secondary: #555;
  --color-text-muted: #888;
  --color-border: #e4e4e4;
  --color-green: #16a34a;
  --color-blue: #2563eb;
  --color-amber: #d97706;
  --color-red: #dc2626;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font-sans); color: var(--color-text); background: var(--color-bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }

/* Header */
.dash-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.94); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--color-border);
  padding: 0 32px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.dash-header__left { display: flex; align-items: center; gap: 16px; }
.dash-header__back { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--color-text-muted); transition: color 150ms; }
.dash-header__back:hover { color: var(--color-text); }
.dash-header__title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.dash-header__badge { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 0; background: var(--color-text); color: #fff; }
.dash-header__actions { display: flex; gap: 8px; }

/* Buttons */
.dash-btn { padding: 7px 14px; font-family: var(--font-sans); font-size: 12px; font-weight: 500; border: 1px solid var(--color-border); border-radius: 0; background: #fff; color: var(--color-text); cursor: pointer; transition: all 150ms; }
.dash-btn:hover { border-color: rgba(0,0,0,0.2); box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.dash-btn--primary { background: var(--color-text); color: #fff; border-color: var(--color-text); }
.dash-btn--primary:hover { background: #333; }
.dash-btn--danger { background: #fff; color: var(--color-red); border-color: var(--color-red); }
.dash-btn--danger:hover { background: #fef2f2; }
.dash-btn--sm { padding: 4px 10px; font-size: 11px; }

/* Body */
.dash-body { max-width: 1200px; margin: 0 auto; padding: 24px 24px 80px; }

/* Stats */
.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat-card { background: #fff; border: 1px solid var(--color-border); border-radius: 0; padding: 18px; }
.stat-card__label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted); margin-bottom: 6px; }
.stat-card__value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }

/* Tabs */
.dash-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--color-border); margin-bottom: 24px; overflow-x: auto; }
.dash-tab { padding: 10px 20px; font-family: var(--font-sans); font-size: 13px; font-weight: 500; border: none; background: none; cursor: pointer; color: var(--color-text-muted); border-bottom: 2px solid transparent; transition: all 150ms; white-space: nowrap; }
.dash-tab:hover { color: var(--color-text); }
.dash-tab.active { color: var(--color-text); border-bottom-color: var(--color-text); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Tables */
.cms-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--color-border); border-radius: 0; overflow: hidden; }
.cms-table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--color-border); background: #fafafa; }
.cms-table td { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid rgba(0,0,0,0.04); vertical-align: middle; }
.cms-table tr:last-child td { border-bottom: none; }
.cms-table tr:hover td { background: rgba(0,0,0,0.015); }
.cms-table .icon-cell { width: 36px; }
.cms-table .icon-cell img { width: 28px; height: 28px; object-fit: contain; border: 1px solid var(--color-border); border-radius: 0; }
.cms-table .actions-cell { white-space: nowrap; text-align: right; }
.score-pill { display: inline-block; padding: 2px 8px; border-radius: 0; font-size: 11px; font-weight: 600; }
.score-pill--us { background: #eff6ff; color: #1d4ed8; }
.score-pill--china { background: #fef3c7; color: #92400e; }
.tier-badge { display: inline-block; padding: 2px 8px; border-radius: 0; font-size: 11px; font-weight: 600; background: #f3f4f6; color: #374151; }

/* Cards list */
.cms-card { background: #fff; border: 1px solid var(--color-border); border-radius: 0; padding: 18px; margin-bottom: 12px; }
.cms-card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cms-card__title { font-size: 14px; font-weight: 600; }
.cms-card__meta { font-size: 12px; color: var(--color-text-muted); }
.cms-card__body { font-size: 13px; color: var(--color-text-secondary); line-height: 1.6; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 100; }
.modal-overlay.show { display: flex; align-items: flex-start; justify-content: center; padding-top: 60px; }
.modal { background: #fff; border-radius: 0; width: 100%; max-width: 600px; max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal__header { padding: 18px 24px; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: #fff; border-radius: 0; z-index: 1; }
.modal__title { font-size: 16px; font-weight: 600; }
.modal__close { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--color-text-muted); padding: 4px 8px; }
.modal__close:hover { color: var(--color-text); }
.modal__body { padding: 24px; }
.modal__footer { padding: 16px 24px; border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: #fff; border-radius: 0; }

/* Form */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.form-input, .form-select { width: 100%; padding: 8px 12px; font-family: var(--font-sans); font-size: 13px; border: 1px solid var(--color-border); border-radius: 0; background: #fff; }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--color-text); }
.form-textarea { width: 100%; padding: 8px 12px; font-family: var(--font-sans); font-size: 13px; border: 1px solid var(--color-border); border-radius: 0; min-height: 80px; resize: vertical; }
.form-textarea:focus { outline: none; border-color: var(--color-text); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 11px; color: var(--color-text-muted); margin-top: 4px; }

/* Section editor items */
.sec-item { background: #f9f9f9; border: 1px solid var(--color-border); border-radius: 0; padding: 14px; margin-bottom: 10px; }
.sec-item__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sec-item__type { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-blue); }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 10px 20px; background: var(--color-text); color: #fff; border-radius: 0; font-size: 13px; font-weight: 500; z-index: 200; opacity: 0; transform: translateY(10px); transition: all 200ms; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }

/* Timeline */
.timeline { display: flex; flex-direction: column; }
.timeline-entry { display: grid; grid-template-columns: 100px 24px 1fr; gap: 0 12px; min-height: 64px; }
.timeline-time { font-size: 12px; color: var(--color-text-muted); text-align: right; padding-top: 4px; line-height: 1.4; }
.timeline-time__date { display: block; font-weight: 500; }
.timeline-time__hour { display: block; font-size: 11px; opacity: 0.7; }
.timeline-dot-col { display: flex; flex-direction: column; align-items: center; position: relative; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--color-border); background: #fff; flex-shrink: 0; margin-top: 6px; z-index: 1; }
.timeline-dot--create { border-color: var(--color-green); background: var(--color-green); }
.timeline-dot--update { border-color: var(--color-blue); background: var(--color-blue); }
.timeline-dot--delete { border-color: var(--color-red); background: var(--color-red); }
.timeline-line { flex: 1; width: 2px; background: var(--color-border); min-height: 20px; }
.timeline-entry:last-child .timeline-line { display: none; }
.timeline-card { background: #fff; border: 1px solid var(--color-border); border-radius: 0; padding: 14px 16px; margin-bottom: 12px; transition: border-color 150ms; }
.timeline-card:hover { border-color: rgba(0,0,0,0.15); }
.timeline-card__top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.timeline-badge { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 0; line-height: 1.4; }
.timeline-badge--layer { background: #eff6ff; color: #1d4ed8; }
.timeline-badge--feed_item { background: #fef3c7; color: #92400e; }
.timeline-badge--site_config { background: #f3e8ff; color: #6b21a8; }
.timeline-badge--summary { background: #ecfdf5; color: #065f46; }
.timeline-badge--contributor { background: #fce7f3; color: #9d174d; }
.timeline-badge--section { background: #fff7ed; color: #9a3412; }
.timeline-badge--tier { background: #f0fdf4; color: #166534; }
.timeline-action { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); }
.timeline-action--create { color: var(--color-green); }
.timeline-action--update { color: var(--color-blue); }
.timeline-action--delete { color: var(--color-red); }
.timeline-card__name { font-size: 14px; font-weight: 600; }
.timeline-card__summary { font-size: 13px; color: var(--color-text-secondary); margin-top: 4px; line-height: 1.5; }
.timeline-card__diff { margin-top: 10px; border-top: 1px solid rgba(0,0,0,0.05); padding-top: 10px; display: none; }
.timeline-card__diff.show { display: block; }
.diff-row { display: grid; grid-template-columns: 100px 1fr; gap: 8px; font-size: 12px; line-height: 1.5; padding: 3px 0; }
.diff-row__field { font-weight: 600; color: var(--color-text-muted); text-transform: capitalize; }
.diff-row__old { color: var(--color-red); text-decoration: line-through; opacity: 0.6; }
.diff-row__new { color: var(--color-green); }
.timeline-card__toggle { font-size: 11px; color: var(--color-text-muted); cursor: pointer; border: none; background: none; font-family: var(--font-sans); padding: 4px 0; margin-top: 6px; }
.timeline-card__toggle:hover { color: var(--color-text); }

/* Filter bar */
.dash-filters { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.dash-filters__label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); margin-right: 4px; }
.filter-chip { padding: 6px 12px; font-family: var(--font-sans); font-size: 12px; font-weight: 500; border: 1px solid var(--color-border); border-radius: 0; background: #fff; cursor: pointer; transition: all 150ms; user-select: none; }
.filter-chip:hover { border-color: rgba(0,0,0,0.2); }
.filter-chip.active { background: var(--color-text); color: #fff; border-color: var(--color-text); }

/* Section title */
.dash-section-title { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); margin-bottom: 16px; }

/* Responsive */
@media (max-width: 860px) {
  .timeline-entry { grid-template-columns: 80px 24px 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .dash-header { padding: 0 16px; }
  .dash-body { padding: 16px 14px 60px; }
  .dash-stats { grid-template-columns: 1fr 1fr; }
  .timeline-entry { grid-template-columns: 1fr; gap: 4px; }
  .timeline-time { text-align: left; }
  .timeline-dot-col { display: none; }
}
