.skill-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-void);
  position: relative;
  overflow: hidden;
}

.bg-grid,
.bg-glow,
.bg-scan,
.bg-orbit,
.bg-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bg-grid {
  background-image:
    linear-gradient(rgba(0,245,212,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,245,212,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridDrift 32s linear infinite;
}

.bg-glow {
  background:
    radial-gradient(ellipse 70% 55% at 50% 15%, rgba(0,245,212,0.07) 0%, transparent 70%),
    radial-gradient(circle at 88% 18%, rgba(123,44,191,0.1) 0%, transparent 22%),
    radial-gradient(circle at 14% 78%, rgba(0,245,212,0.08) 0%, transparent 24%);
  animation: glowPulse 8.6s ease-in-out infinite alternate;
}

.bg-scan {
  inset: -20% 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0,245,212,0.022) 46%, rgba(0,245,212,0.048) 50%, rgba(0,245,212,0.022) 54%, transparent 100%);
  opacity: 0.45;
  animation: scan 12s linear infinite;
}

.bg-orbit {
  inset: -12%;
  background:
    radial-gradient(circle at center, transparent 0 31%, rgba(0,245,212,0.08) 31.2%, transparent 31.8%),
    radial-gradient(circle at center, transparent 0 44%, rgba(123,44,191,0.06) 44.2%, transparent 44.8%);
  opacity: 0.32;
  animation: orbitSpin 42s linear infinite;
}

.bg-particles {
  background-image:
    radial-gradient(circle at 16% 22%, rgba(234,252,255,0.28) 0 1.4px, transparent 1.6px),
    radial-gradient(circle at 72% 34%, rgba(0,245,212,0.2) 0 1.2px, transparent 1.5px),
    radial-gradient(circle at 82% 68%, rgba(123,44,191,0.22) 0 1.4px, transparent 1.7px),
    radial-gradient(circle at 34% 78%, rgba(234,252,255,0.22) 0 1.1px, transparent 1.4px);
  animation: particleDrift 24s ease-in-out infinite alternate;
}

@keyframes gridDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 18px 12px, 18px 12px; }
}

@keyframes glowPulse {
  from { opacity: 0.82; transform: scale(1); }
  to { opacity: 1; transform: scale(1.03); }
}

@keyframes scan {
  from { transform: translateY(-16%); }
  to { transform: translateY(16%); }
}

@keyframes orbitSpin {
  from { transform: rotate(0deg) scale(1); }
  to { transform: rotate(360deg) scale(1.02); }
}

@keyframes particleDrift {
  from { transform: translate3d(-8px, 0, 0); opacity: 0.34; }
  to { transform: translate3d(10px, -8px, 0); opacity: 0.52; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.view-header,
.metrics-strip,
.toolbar,
.console-layout,
.empty-state {
  position: relative;
  z-index: 1;
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border-dim);
  background: rgba(5,8,16,0.7);
  backdrop-filter: blur(10px);
}

.header-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.header-title {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--text-primary);
}

.title-bracket {
  color: var(--accent-cyan);
  opacity: 0.6;
}

.header-subtitle {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.metric-label,
.panel-kicker,
.filter-label,
.mono-pill,
.source-badge,
.status-pill,
.visibility-badge,
.modal-title,
.form-label,
.mcp-section-title,
.mcp-section-count {
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.overview-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border-mid);
  background: rgba(10, 15, 26, 0.82);
  font-size: 10px;
}

.source-badge.builtin,
.builtin-badge {
  color: var(--accent-amber);
  border-color: rgba(249,168,37,0.24);
  background: rgba(249,168,37,0.08);
}

.source-badge.custom {
  color: var(--accent-cyan);
  border-color: rgba(0,245,212,0.24);
  background: rgba(0,245,212,0.08);
}

.btn-mcp,
.btn-add,
.detail-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-mcp {
  background: rgba(123,44,191,0.12);
  border: 1px solid rgba(123,44,191,0.36);
  color: var(--accent-purple);
}

.btn-mcp:hover {
  background: rgba(123,44,191,0.18);
  border-color: var(--accent-purple);
  box-shadow: 0 0 20px rgba(123,44,191,0.18);
}

.btn-add,
.detail-action,
.btn-primary {
  background: rgba(0,245,212,0.08);
  border: 1px solid rgba(0,245,212,0.3);
  color: var(--accent-cyan);
}

.btn-add:hover,
.detail-action:hover,
.btn-primary:hover:not(:disabled) {
  background: rgba(0,245,212,0.15);
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 24px 0;
}

.metric-panel,
.table-panel,
.detail-panel,
.loading-shell .table-shell {
  border: 1px solid rgba(0,245,212,0.12);
  background: linear-gradient(180deg, rgba(8,13,22,0.92), rgba(5,9,18,0.88));
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 36px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.04);
}

.metric-panel {
  min-height: 82px;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-label,
.panel-kicker,
.detail-label {
  font-size: 10px;
  color: var(--text-dim);
}

.metric-value,
.panel-title,
.detail-stat strong {
  font-family: 'Fira Code', var(--font-display), monospace;
  color: var(--text-primary);
}

.metric-value {
  font-size: 24px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 24px 0;
}

.search-box {
  min-width: 300px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(0,245,212,0.14);
  background: rgba(8,13,22,0.88);
  color: var(--text-secondary);
}

.search-box input,
.filter-select,
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: 'Fira Sans', var(--font-mono), sans-serif;
  font-size: 13px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 10px;
}

.filter-select {
  width: auto;
  min-width: 132px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,245,212,0.14);
  background: rgba(8,13,22,0.88);
  text-transform: uppercase;
  font-family: var(--font-mono);
  font-size: 11px;
}

.console-layout {
  flex: 1;
  min-height: 0;
  padding: 16px 24px 24px;
  overflow: hidden;
}

.table-panel,
.detail-drawer {
  border-radius: 18px;
  min-height: 0;
  overflow: hidden;
}

.table-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.table-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(0,245,212,0.1);
}

.panel-title {
  margin: 6px 0 0;
  font-size: 18px;
}

.panel-meta {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 11px;
}

.skills-table-wrap,
.mcp-table-wrap {
  overflow: auto;
}

.skills-table-wrap {
  flex: 1;
  min-height: 0;
  padding-bottom: 14px;
  box-sizing: border-box;
}

.skills-table,
.mcp-table {
  width: 100%;
  border-collapse: collapse;
}

.skills-table thead th,
.mcp-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 12px 14px;
  background: rgba(9,16,28,0.96);
  border-bottom: 1px solid rgba(0,245,212,0.12);
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.table-row,
.mcp-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.table-row:hover,
.mcp-table tbody tr:hover {
  background: rgba(0,245,212,0.05);
}

.table-row.selected {
  background: rgba(0,245,212,0.08);
  box-shadow: inset 3px 0 0 rgba(0,245,212,0.9);
}

.table-row.inactive {
  opacity: 0.65;
}

.skills-table td,
.mcp-table td {
  padding: 14px;
  vertical-align: middle;
  color: var(--text-secondary);
  font-size: 12px;
}

.skill-cell-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}

.skill-row-trigger {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.skill-row-trigger:focus-visible {
  outline: 1px solid rgba(0,245,212,0.7);
  outline-offset: 4px;
  border-radius: 12px;
}

.skill-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.skill-icon {
  color: var(--accent-cyan);
}

.skill-name {
  color: var(--text-primary);
  font-family: 'Fira Code', var(--font-display), monospace;
  font-weight: 600;
  font-size: 13px;
}

.inline-badge,
.mono-pill,
.source-badge,
.visibility-badge,
.status-pill,
.tool-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(0,245,212,0.14);
  font-size: 10px;
}

.mono-pill {
  color: var(--accent-cyan);
  background: rgba(0,245,212,0.08);
}

.visibility-badge.private {
  color: var(--accent-red);
  border-color: rgba(255,71,87,0.2);
  background: rgba(255,71,87,0.08);
}

.visibility-badge.team {
  color: var(--accent-amber);
  border-color: rgba(249,168,37,0.2);
  background: rgba(249,168,37,0.08);
}

.visibility-badge.market {
  color: var(--accent-green);
  border-color: rgba(0,230,118,0.2);
  background: rgba(0,230,118,0.08);
}

.status-pill {
  gap: 8px;
  color: var(--text-primary);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.status-pill.active {
  color: var(--accent-cyan);
  background: rgba(0,245,212,0.08);
}

.status-pill.inactive {
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
}

.numeric-cell,
.updated-cell {
  font-family: 'Fira Code', var(--font-display), monospace;
  color: var(--text-primary);
}

.tool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tool-list.compact {
  max-width: 220px;
}

.tool-tag {
  color: var(--accent-purple);
  background: rgba(123,44,191,0.08);
  border-color: rgba(123,44,191,0.18);
  text-transform: none;
}

.tool-tag.ghost {
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}

.skill-description,
.detail-copy,
.mcp-description {
  line-height: 1.55;
}

.skill-actions {
  display: flex;
  gap: 4px;
}

.action-btn,
.btn-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-btn:hover,
.btn-close:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.action-btn.edit:hover {
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

.action-btn.delete:hover,
.btn-close:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.action-btn.active {
  color: var(--accent-cyan);
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(4px);
  z-index: 180;
  display: flex;
  justify-content: flex-end;
}

.detail-drawer {
  width: min(420px, calc(100vw - 24px));
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-left: 1px solid rgba(0,245,212,0.16);
  background: rgba(8,13,22,0.96);
  box-shadow: -20px 0 60px rgba(0,0,0,0.45);
  outline: none;
}

.detail-header {
  align-items: flex-start;
}

.detail-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-section {
  padding: 18px;
  border-bottom: 1px solid rgba(0,245,212,0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.detail-stat {
  border: 1px solid rgba(0,245,212,0.1);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-code {
  margin: 0;
  white-space: pre-wrap;
  font-family: 'Fira Code', var(--font-mono), monospace;
  font-size: 11px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.loading-shell {
  flex: 1;
  padding: 16px 24px 24px;
}

.loading-shell .table-shell {
  border-radius: 18px;
  min-height: 360px;
  padding: 16px;
}

.table-shell-head,
.table-shell-row {
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(0,245,212,0.08), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}

.table-shell-head {
  height: 48px;
  margin-bottom: 14px;
}

.table-shell-row {
  height: 52px;
  margin-bottom: 10px;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.empty-icon {
  color: var(--text-dim);
  opacity: 0.5;
}

.empty-text {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

.mcp-panel {
  width: min(1040px, calc(100vw - 40px));
}

.mcp-summary {
  padding: 14px 16px;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  background: rgba(6, 10, 20, 0.72);
}

.mcp-summary-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
}

.mcp-summary-text {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.mcp-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mcp-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mcp-pack-name {
  font-family: 'Fira Code', var(--font-display), monospace;
  color: var(--text-primary);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-card {
  width: 520px;
  max-height: 85vh;
  background: rgba(10,15,26,.98);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(0,245,212,.05);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-dim);
}

.modal-footer {
  justify-content: stretch;
  border-bottom: none;
  border-top: 1px solid var(--border-dim);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.flex-1 {
  flex: 1;
}

.form-row {
  display: flex;
  gap: 14px;
}

.form-row .form-group {
  flex: 1;
}

.form-input,
.form-textarea,
.form-select {
  min-height: 42px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-mid);
  background: var(--bg-card);
}

.form-textarea {
  resize: none;
  line-height: 1.5;
}

.code-textarea {
  min-height: 180px;
  font-family: 'Fira Code', var(--font-mono), monospace;
  font-size: 11px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tool-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

.tool-checkbox input {
  display: none;
}

.checkbox-custom {
  width: 14px;
  height: 14px;
  border: 1px solid var(--border-mid);
  border-radius: 3px;
  background: var(--bg-card);
  position: relative;
  flex-shrink: 0;
}

.tool-checkbox input:checked + .checkbox-custom {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.tool-checkbox input:checked + .checkbox-custom::after {
  content: '\2713';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--bg-void);
  font-size: 10px;
}

.btn-secondary,
.btn-primary {
  flex: 1;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-loader {
  width: 12px;
  height: 12px;
  border: 1.5px solid transparent;
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1200px) {
  .detail-drawer {
    width: min(420px, calc(100vw - 20px));
  }
}

@media (max-width: 960px) {
  .metrics-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar,
  .view-header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .search-box {
    min-width: 0;
    width: 100%;
  }

  .skills-table-wrap {
    overflow-x: auto;
  }

  .detail-drawer {
    width: min(100vw, 100%);
  }
}

@media (max-width: 720px) {
  .metrics-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row {
    flex-direction: column;
  }

  .detail-drawer {
    width: 100vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-grid,
  .bg-glow,
  .bg-scan,
  .bg-orbit,
  .bg-particles,
  .btn-loader {
    animation: none !important;
    transform: none !important;
  }
}
