* { box-sizing: border-box; }

:root {
  --bg: #070b14;
  --bg-2: #0b1322;
  --surface: rgba(18, 27, 42, 0.82);
  --surface-2: rgba(14, 22, 35, 0.86);
  --surface-3: #0f1827;
  --border: rgba(120, 147, 196, 0.22);
  --border-strong: rgba(140, 170, 224, 0.36);
  --text: #eef4ff;
  --muted: #9db0cf;
  --accent: #4f8dff;
  --accent-soft: rgba(79, 141, 255, 0.2);
  --green: #3cd39d;
  --red: #ff6e78;
  --yellow: #ffcc66;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 24px rgba(2, 7, 17, 0.42);
  --shadow-soft: 0 6px 18px rgba(1, 7, 16, 0.32);
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--text);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  background:
    radial-gradient(1200px 600px at 14% -10%, rgba(79, 141, 255, 0.2), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(60, 211, 157, 0.1), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.18;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 30px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 14, 24, 0.82);
  backdrop-filter: blur(12px);
}

.topbar-left h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0.2px;
  text-shadow: 0 0 28px rgba(79, 141, 255, 0.22);
}

.topbar-left p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.clock {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #d6e3ff;
  background: rgba(14, 25, 40, 0.88);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
}

.lang-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(10, 17, 28, 0.9);
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.16s ease;
}

.lang-btn.active {
  background: linear-gradient(180deg, #619eff 0%, #3f7dff 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 141, 255, 0.35);
}

.tabs {
  position: sticky;
  top: 84px;
  z-index: 18;
  display: flex;
  gap: 8px;
  padding: 10px 30px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 14, 24, 0.72);
  backdrop-filter: blur(10px);
}

.tab-link {
  text-decoration: none;
  color: var(--muted);
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  transition: all 0.16s ease;
}

.tab-link:hover {
  color: var(--text);
  border-color: var(--border);
  background: rgba(17, 27, 44, 0.7);
}

.tab-link.active {
  color: #fff;
  border-color: rgba(113, 153, 224, 0.6);
  background: linear-gradient(180deg, rgba(79, 141, 255, 0.26) 0%, rgba(79, 141, 255, 0.16) 100%);
  box-shadow: inset 0 0 0 1px rgba(100, 148, 233, 0.35);
}

main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 26px;
}

.section { display: none; }
.section.active { display: block; }

.section-head h2 {
  margin: 0;
  font-size: 23px;
}

.section-head p {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
  animation: card-enter 0.24s ease both;
}

.card:hover {
  border-color: var(--border-strong);
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.card-header-row h3 {
  margin: 0;
  font-size: 17px;
}

.inline-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

label {
  font-size: 13px;
  color: var(--muted);
}

input, select, textarea {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: #79a8ff;
  box-shadow: 0 0 0 3px rgba(79, 141, 255, 0.2);
}

.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  background: linear-gradient(180deg, #5f9aff 0%, #3e7aff 100%);
  color: #fff;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.2px;
  transition: transform 0.12s ease, box-shadow 0.16s ease, opacity 0.16s ease;
  box-shadow: 0 5px 16px rgba(79, 141, 255, 0.28);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(79, 141, 255, 0.34);
}

.btn:active { transform: translateY(0); }
.btn.full { width: 100%; margin-top: 8px; }

.btn.btn-secondary {
  background: rgba(40, 57, 82, 0.9);
  border-color: var(--border);
  box-shadow: none;
  color: #d8e6ff;
}

.json-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.status-msg {
  min-height: 18px;
  color: var(--muted);
  margin-bottom: 10px;
  font-size: 14px;
}

.status-msg.success { color: var(--green); }
.status-msg.error { color: var(--red); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

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

.kpi {
  position: relative;
  background: linear-gradient(180deg, rgba(16, 25, 40, 0.92) 0%, rgba(12, 20, 34, 0.9) 100%);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px;
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #6ea7ff 0%, #49c9ff 100%);
  opacity: 0.85;
}

.kpi span {
  font-size: 12px;
  color: var(--muted);
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

.kpi strong {
  margin-top: 6px;
  display: block;
  font-size: 18px;
  color: #f4f8ff;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 11px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #121f33;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.45px;
}

.data-table th,
.data-table td {
  padding: 10px 11px;
  border-bottom: 1px solid rgba(130, 161, 213, 0.16);
  text-align: left;
  white-space: nowrap;
}

.data-table tbody tr {
  background: rgba(9, 16, 27, 0.44);
}

.data-table tbody tr:nth-child(even) {
  background: rgba(13, 21, 35, 0.52);
}

.data-table tbody tr:hover {
  background: rgba(28, 44, 70, 0.72);
}

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

.skills-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.skills-main {
  display: grid;
  gap: 16px;
}

.skills-workspace-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.skill-result-card {
  min-height: 760px;
}

.skill-controls-card {
  display: grid;
  gap: 10px;
}

.skill-profile-card {
  padding: 18px;
}

.skill-profile-inline {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(12, 20, 34, 0.52);
}

.skill-profile-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

#skill-title {
  margin: 8px 0 6px;
  font-size: 34px;
  line-height: 1.12;
}

.skill-endpoint-box {
  min-width: 240px;
  background: rgba(10, 18, 30, 0.72);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.skill-endpoint-box code {
  font-size: 14px;
  color: #cae0ff;
  word-break: break-all;
}

.skill-profile-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.skill-profile-grid article {
  background: rgba(12, 20, 34, 0.74);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

.skill-profile-grid h4 {
  margin: 0 0 7px;
  font-size: 18px;
  color: #d7e6ff;
}

.skill-profile-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.control-block {
  display: grid;
  grid-template-columns: minmax(320px, 640px);
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.control-block .hint {
  margin: 0;
}

.skill-select {
  font-weight: 700;
  font-size: 18px;
  background: linear-gradient(180deg, rgba(16, 27, 44, 0.95) 0%, rgba(12, 22, 35, 0.95) 100%);
  border: 1px solid rgba(123, 157, 221, 0.42);
  box-shadow: inset 0 0 0 1px rgba(99, 138, 214, 0.18);
}

.skill-select optgroup {
  color: #c1d7ff;
  font-weight: 700;
  background: #111b2a;
}

.skill-select option {
  color: #e8f1ff;
  background: #101a2a;
  font-weight: 500;
}

.dynamic-form {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.dynamic-form label {
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.dynamic-form input,
.dynamic-form select,
.advanced-json { width: 100%; }

.advanced-box {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px;
  background: rgba(9, 16, 27, 0.72);
  margin: 9px 0;
}

.advanced-box summary {
  cursor: pointer;
  font-size: 16px;
  color: #c6d9fb;
  font-weight: 600;
}

.advanced-json {
  margin-top: 8px;
  min-height: 96px;
  background: #0b1424;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}

.skill-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 8px;
  margin-top: 10px;
}

.hint {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.code-block {
  margin: 0;
  background: #0b1322;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  max-height: 360px;
  overflow: auto;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-output {
  background: #0b1322;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  min-height: 340px;
  max-height: 620px;
  overflow-y: auto;
  overflow-x: hidden;
  line-height: 1.45;
  font-size: 17px;
  white-space: normal;
  word-break: break-word;
}

.ai-output h3,
.ai-output h4,
.ai-output h5 {
  margin: 11px 0 7px;
  color: #edf4ff;
}

.ai-output p {
  margin: 7px 0;
  color: #dfeaff;
}

.ai-output ul {
  margin: 7px 0 9px 18px;
  padding: 0;
}

.ai-output li {
  margin-bottom: 6px;
  color: #dde8ff;
}

.ai-confidence {
  margin: 0 0 10px;
}

.ai-actions {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}

.ai-options {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--text);
}

.inline-check input {
  width: 16px;
  height: 16px;
}

.ai-actions label {
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

.pill {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(18, 31, 50, 0.9);
  color: #d3e4ff;
  font-weight: 600;
  font-size: 14px;
}

#skills .section-head h2 {
  font-size: 36px;
  line-height: 1.1;
}

#skills .section-head p {
  font-size: 18px;
  line-height: 1.6;
}

#skills .card h3 {
  font-size: 24px;
}

#skills label {
  font-size: 15px;
}

#skills input,
#skills select,
#skills textarea {
  font-size: 16px;
  padding: 11px 12px;
}

#skills .btn {
  font-size: 15px;
  padding: 11px 14px;
}

.btn.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.85;
  color: transparent;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

.semantic-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.3;
}

.semantic-badge.is-positive,
.semantic-badge.confidence-high {
  color: var(--green);
  border-color: rgba(60, 211, 157, 0.45);
  background: rgba(60, 211, 157, 0.12);
}

.semantic-badge.is-negative,
.semantic-badge.confidence-low {
  color: var(--red);
  border-color: rgba(255, 110, 120, 0.45);
  background: rgba(255, 110, 120, 0.12);
}

.semantic-badge.is-neutral,
.semantic-badge.confidence-medium {
  color: var(--yellow);
  border-color: rgba(255, 204, 102, 0.45);
  background: rgba(255, 204, 102, 0.12);
}

.semantic-badge.is-default {
  color: #dbe8ff;
  background: rgba(80, 110, 160, 0.18);
}

.skeleton-row td {
  padding-top: 12px;
  padding-bottom: 12px;
}

.skeleton-line {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(130, 161, 213, 0.12) 25%, rgba(130, 161, 213, 0.28) 37%, rgba(130, 161, 213, 0.12) 63%);
  background-size: 220% 100%;
  animation: shimmer 1.1s linear infinite;
}

.pos { color: var(--green); font-weight: 700; }
.neg { color: var(--red); font-weight: 700; }

footer {
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  padding: 24px 20px 28px;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: rgba(8, 13, 23, 0.72);
}

::-webkit-scrollbar-thumb {
  background: rgba(104, 134, 190, 0.45);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(126, 161, 224, 0.62);
}

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

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

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .skeleton-line {
    animation: none;
  }
}

@media (max-width: 1100px) {
  .skills-layout { grid-template-columns: 1fr; }
  .skills-workspace-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .control-block { grid-template-columns: 1fr; align-items: start; }
}

@media (max-width: 760px) {
  .topbar,
  .tabs,
  main { padding-left: 12px; padding-right: 12px; }

  .topbar { padding-top: 14px; padding-bottom: 14px; }
  .topbar-left h1 { font-size: 20px; }

  .tabs {
    top: 73px;
    overflow: auto;
    white-space: nowrap;
  }

  .kpi-grid,
  .kpi-grid.compact,
  .skill-actions,
  .ai-actions { grid-template-columns: 1fr; }

  .skill-profile-head,
  .skill-profile-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .skill-endpoint-box {
    min-width: 0;
  }
}
