/* ===== Skill Inventory Dashboard ===== */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #222639;
  --bg-hover: #2a2f45;
  --border: #2e3350;
  --text-primary: #e4e6f0;
  --text-secondary: #8b8fa3;
  --text-muted: #5a5e72;
  --accent-blue: #4f8cff;
  --accent-green: #34d399;
  --accent-orange: #f59e0b;
  --accent-purple: #a78bfa;
  --accent-red: #ef4444;
  --accent-cyan: #22d3ee;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

.container { max-width: 1400px; margin: 0 auto; padding: 20px; }

/* Header */
.header {
  text-align: center;
  padding: 40px 20px 30px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, #1e2030 100%);
  border-bottom: 1px solid var(--border);
}
.header h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header p {
  color: var(--text-secondary);
  margin-top: 8px;
  font-size: 14px;
}
.header .last-updated {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 20px 0;
}
.stat-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-card .value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}
.stat-card .label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-card.hermes .value { color: var(--accent-blue); }
.stat-card.openclaw .value { color: var(--accent-orange); }
.stat-card.shared .value { color: var(--accent-green); }
.stat-card.total .value { color: var(--accent-purple); }
.stat-card.active .value { color: var(--accent-cyan); }
.stat-card.disabled .value { color: var(--text-muted); }
.stat-card.size .value { font-size: 20px; color: var(--accent-orange); }

/* Charts */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.chart-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 14px;
  border: 1px solid var(--border);
}
.chart-card h3 {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.chart-card canvas { max-height: 240px; }
@media (max-width: 768px) { .charts-row { grid-template-columns: 1fr; } }

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px;
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.filters label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-right: 2px;
}
.filters select, .filters input {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
}
.filters select:focus, .filters input:focus { border-color: var(--accent-blue); }
.filters input[type="text"] { min-width: 180px; flex: 1; }
.filter-group { display: flex; align-items: center; gap: 4px; }
.filter-count { font-size: 12px; color: var(--text-muted); margin-left: auto; }

/* Table */
.table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.skill-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.skill-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.skill-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #1e2235;
  vertical-align: middle;
}
.skill-table tr:hover { background: var(--bg-hover); }
.skill-table tr:last-child td { border-bottom: none; }

.skill-name { font-weight: 600; white-space: nowrap; }
.skill-desc {
  color: var(--text-muted);
  font-size: 12px;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-hermes { background: rgba(79,140,255,0.15); color: var(--accent-blue); }
.badge-openclaw { background: rgba(245,158,11,0.15); color: var(--accent-orange); }
.badge-shared { background: rgba(52,211,153,0.15); color: var(--accent-green); }
.badge-active { background: rgba(34,211,238,0.1); color: var(--accent-cyan); }
.badge-disabled { background: rgba(90,94,114,0.2); color: var(--text-muted); }
.badge-symlink { background: rgba(167,139,250,0.15); color: var(--accent-purple); }
.badge-category { background: rgba(251,191,36,0.12); color: var(--accent-orange); }
.badge-official { background: rgba(79,140,255,0.15); color: var(--accent-blue); }
.badge-official-disabled { background: rgba(90,94,114,0.2); color: var(--text-muted); }
.badge-optional { background: rgba(167,139,250,0.15); color: var(--accent-purple); }
.badge-hub { background: rgba(52,211,153,0.15); color: var(--accent-green); }
.badge-sensenova { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.badge-openclaw { background: rgba(245,158,11,0.15); color: var(--accent-orange); }
.badge-custom { background: rgba(34,211,238,0.1); color: var(--accent-cyan); }

.skill-path {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 11px;
  color: var(--text-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
}
.skill-path:hover { color: var(--text-secondary); }

.cat-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  background: rgba(79,140,255,0.08);
  color: var(--accent-blue);
  border: 1px solid rgba(79,140,255,0.15);
}

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 40px; margin-bottom: 10px; }

/* ===== Detail Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.modal-overlay.visible { display: flex; }

.modal-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

#modal-body {
  padding: 16px 24px 24px;
}

.detail-header {
  margin-bottom: 16px;
}
.detail-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.detail-section {
  margin-bottom: 16px;
}
.detail-section h4 {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.detail-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
}

.detail-info {
  width: 100%;
  font-size: 13px;
}
.detail-info td {
  padding: 4px 8px 4px 0;
  vertical-align: top;
}
.detail-info td:first-child {
  color: var(--text-muted);
  white-space: nowrap;
  width: 80px;
}
.detail-info code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 12px;
  color: var(--accent-cyan);
  word-break: break-all;
}

.sub-skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sub-skill-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(79,140,255,0.1);
  color: var(--accent-blue);
  font-size: 12px;
  border: 1px solid rgba(79,140,255,0.15);
}

.file-list {
  max-height: 200px;
  overflow-y: auto;
  font-size: 12px;
}
.file-item {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid rgba(46,51,80,0.3);
}
.file-item:last-child { border-bottom: none; }
.file-name { color: var(--text-secondary); }
.file-size { color: var(--text-muted); font-family: monospace; }

@media (max-width: 768px) {
  .modal-panel { max-height: 90vh; border-radius: 12px; margin: 10px; }
  .skill-table th:nth-child(4), .skill-table td:nth-child(4) { display: none; }
  .skill-table th:nth-child(5), .skill-table td:nth-child(5) { display: none; }
}

/* Footer */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 12px;
}
.footer a {
  color: var(--accent-blue);
  text-decoration: none;
}
.footer a:hover { text-decoration: underline; }