/* ── Hermes Portal Theme ──────────────────────────────────────── */
:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-hover: #1c2333;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --orange: #d29922;
  --purple: #bc8cff;
  --cyan: #39d2c0;
  --yellow: #e3b341;
  --pink: #f778ba;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ──────────────────────────────────────── */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar h1 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar h1 span { color: var(--accent); }

.topbar .server-info {
  font-size: 12px;
  color: var(--text-dim);
}

nav {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

nav a {
  padding: 10px 16px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}

nav a:hover { color: var(--text); background: var(--bg-hover); }
nav a.active { color: var(--accent); border-bottom-color: var(--accent); }

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* ── Cards ──────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }

.card .value {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.card .label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card.blue .value { color: var(--accent); }
.card.green .value { color: var(--green); }
.card.orange .value { color: var(--orange); }
.card.purple .value { color: var(--purple); }
.card.cyan .value { color: var(--cyan); }
.card.pink .value { color: var(--pink); }

/* ── Pipeline ──────────────────────────────────────── */
.pipeline {
  position: relative;
  padding-left: 40px;
  margin: 24px 0;
}

.pipeline::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.pipeline-item {
  position: relative;
  padding: 12px 16px;
  margin-bottom: 4px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.pipeline-item .icon {
  position: absolute;
  left: -32px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.pipeline-item.active .icon { border-color: var(--green); background: #0d2b16; }
.pipeline-item.paused .icon { border-color: var(--orange); background: #2d1f0a; }
.pipeline-item.inactive .icon { border-color: var(--border); }
.pipeline-item.neutral .icon { border-color: var(--accent); background: #0a1a2d; }

.pipeline-item .time { font-size: 12px; color: var(--text-dim); min-width: 60px; }
.pipeline-item .label { font-weight: 500; }
.pipeline-item .status-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.pipeline-item.active .status-badge { background: #0d2b16; color: var(--green); }
.pipeline-item.paused .status-badge { background: #2d1f0a; color: var(--orange); }
.pipeline-item.inactive .status-badge { background: #1a1a1a; color: var(--text-dim); }
.pipeline-item.neutral .status-badge { background: #0a1a2d; color: var(--accent); }

/* ── Script/Skill list ──────────────────────────────────────── */
.list-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.list-header h2 { font-size: 20px; }

.search-box {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.search-box input:focus { border-color: var(--accent); }
.search-box .icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
}

.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-tabs a {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-card);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 0.15s;
}

.filter-tabs a:hover { color: var(--text); border-color: var(--text-dim); }
.filter-tabs a.active { color: var(--accent); border-color: var(--accent); }

.item-grid {
  display: grid;
  gap: 12px;
}

.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  transition: all 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.item-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.item-card .item-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.item-card .item-title .badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}

.badge.py { background: #1a3a2a; color: var(--green); }
.badge.sh { background: #2d1f0a; color: var(--orange); }
.badge.md { background: #0a2a3a; color: var(--cyan); }

.item-card .item-meta {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.item-card .item-desc {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

.item-card .item-lines {
  margin-top: 6px;
  color: var(--green);
  font-size: 11px;
}

/* ── Cron table ──────────────────────────────────────── */
.cron-section { margin-bottom: 32px; }
.cron-section h3 { margin-bottom: 12px; font-size: 16px; }

.cron-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cron-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cron-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.cron-table tr:hover td { background: var(--bg-hover); }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.status-badge.ok { background: #0d2b16; color: var(--green); }
.status-badge.fail { background: #2d0f0f; color: var(--red); }
.status-badge.paused { background: #2d1f0a; color: var(--orange); }
.status-badge.scheduled { background: #0a1a2d; color: var(--accent); }

/* ── Script Detail ──────────────────────────────────────── */
.script-header {
  margin-bottom: 20px;
}

.script-header .breadcrumb {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.script-header .breadcrumb a { color: var(--accent); text-decoration: none; }

.script-header h2 { font-size: 22px; margin-bottom: 8px; }

.script-meta {
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.script-meta span { display: flex; align-items: center; gap: 4px; }

.source-viewer {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.source-viewer .toolbar {
  padding: 8px 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
}

.source-viewer .toolbar a {
  color: var(--accent);
  text-decoration: none;
}

.source-viewer pre {
  padding: 16px;
  overflow-x: auto;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.6;
  tab-size: 4;
}

.source-viewer pre .kw { color: #ff7b72; }
.source-viewer pre .str { color: #a5d6ff; }
.source-viewer pre .cm { color: #8b949e; }
.source-viewer pre .fn { color: #d2a8ff; }
.source-viewer pre .num { color: #79c0ff; }
.source-viewer pre .dec { color: #79c0ff; }
.source-viewer pre .imp { color: #f97583; }
.source-viewer pre .op { color: #ffa657; }
.source-viewer pre .bu { color: #d2a8ff; }

/* ── Outputs ──────────────────────────────────────── */
.file-list {
  display: grid;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
}

.file-item:hover { border-color: var(--accent); background: var(--bg-hover); }

.file-item .file-icon { font-size: 18px; }
.file-item .file-info { flex: 1; }
.file-item .file-name { font-size: 13px; font-weight: 500; }
.file-item .file-meta { font-size: 11px; color: var(--text-dim); }
.file-item .file-size { font-size: 11px; color: var(--text-dim); }

/* ── Search ──────────────────────────────────────── */
.search-page .search-big {
  max-width: 600px;
  margin: 40px auto;
}

.search-page .search-big input {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s;
}

.search-page .search-big input:focus { border-color: var(--accent); }

.search-section { margin-bottom: 24px; }

.search-section h3 {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-section h3 .count {
  background: var(--bg-hover);
  padding: 1px 8px;
  border-radius: 8px;
  font-size: 11px;
}

.search-none {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.search-none .big-icon { font-size: 48px; margin-bottom: 16px; }

/* ── Misc ──────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

@media (max-width: 768px) {
  nav { padding: 0 12px; }
  main { padding: 12px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .list-header { flex-direction: column; align-items: stretch; }
  .search-box { max-width: none; }
  .cron-table { font-size: 11px; }
  .cron-table th, .cron-table td { padding: 6px 8px; }
}
