/* Hermes Home - Usage, Developer and Connectors pages.
   Uses the tokens defined in styles.css. */

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions .btn { white-space: nowrap; }
.fine { font-size: 12.5px; margin-top: 14px; }
.field-label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--muted); font-weight: 550; }
.field-label .field { color: var(--text); font-weight: 400; }
.field.search { width: 260px; }
.dlg.wide { width: min(560px, calc(100% - 32px)); }
.dlg-form .segmented { align-self: flex-start; }
code { font-family: var(--mono); font-size: 0.9em; padding: 1px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-soft); }

.code-area {
  width: 100%; min-height: 220px; resize: vertical; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--code-bg); color: var(--text-soft);
  font-family: var(--mono); font-size: 13px; line-height: 1.6; outline: none;
}
.code-area.small { min-height: 74px; height: 74px; font-size: 12.5px; }
.code-area:focus { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }

.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text-soft); font-size: 13.5px;
}
.notice.warn { background: rgba(224, 164, 90, 0.1); border-color: rgba(224, 164, 90, 0.35); }

/* Page layout: these views scroll as a column, like Folders and Settings */

#view-usage, #view-developer, #view-connectors {
  flex-direction: column; overflow-y: auto; padding: 26px 30px 40px; gap: 0;
}

/* Usage */

.stat-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.stat {
  display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-md); min-width: 0;
}
.stat.hero { border-color: var(--accent-line); background: linear-gradient(160deg, var(--accent-soft), var(--surface) 60%); }
.stat-num { font-family: var(--display); font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; color: var(--text); }
.stat-num.sm { font-size: 26px; }
.stat .meta { font-size: 12.5px; }
.bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin: 4px 0; }
.bar > span { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); transition: width 0.6s var(--ease); }

.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
.split > .panel { margin-bottom: 0; }

.chart { display: flex; align-items: flex-end; gap: 4px; height: 170px; padding-top: 8px; }
.chart .col { flex: 1; min-width: 4px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.chart .col span {
  display: block; width: 100%; min-height: 2px; border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent)); opacity: 0.85; transition: opacity 0.2s;
}
.chart .col:hover span { opacity: 1; box-shadow: 0 0 14px -2px var(--accent-glow); }
.chart-empty { color: var(--muted); font-size: 14px; padding: 40px 0; text-align: center; }

.table { display: flex; flex-direction: column; font-size: 14px; }
.table .tr {
  display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(var(--cols, 3), minmax(0, 1fr));
  gap: 12px; align-items: center; padding: 11px 4px; border-bottom: 1px solid var(--line);
}
.table .tr.head {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--dim); border-bottom-color: var(--line-strong);
}
.table .tr > span:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.table .name { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 550; }
.table .name .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .empty-cell { color: var(--muted); padding: 14px 4px; }

.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--line-strong); color: var(--muted); background: var(--surface-2); white-space: nowrap;
}
.tag.ok { color: var(--accent-hi); border-color: var(--accent-line); background: var(--accent-soft); }
.tag.bad { color: var(--danger); border-color: rgba(229, 100, 92, 0.4); background: var(--danger-soft); }
.tag.warn { color: var(--warn); border-color: rgba(224, 164, 90, 0.4); background: rgba(224, 164, 90, 0.1); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot-live.ok { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* Developer */

#mcp-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.mcp-card .card-sub { white-space: pre-wrap; }
.script-body { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; min-height: 420px; align-items: start; }
.script-list { max-height: 70vh; overflow-y: auto; }
.script-files { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.script-files button {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--text-soft); font: inherit; font-family: var(--mono); font-size: 13px; text-align: left; cursor: pointer;
}
.script-files button:hover { background: var(--surface-2); }
.script-files button[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.script-editor { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.script-editor .code-area { min-height: 46vh; }
.script-empty { color: var(--muted); text-align: center; padding: 60px 20px; }

/* Connectors */

.conn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.conn-wide { grid-column: 1 / -1; }
.skill-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; margin-top: 14px; max-height: 480px; overflow-y: auto; padding-right: 4px; }
.skill-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.skill-row .sk-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.skill-row .sk-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skill-row .sk-desc { font-size: 12.5px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.skill-row input.switch {
  width: 42px; height: 24px; flex: none; margin: 0; appearance: none; -webkit-appearance: none; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--line-strong); position: relative; cursor: pointer; transition: background 0.25s var(--ease);
}
.skill-row input.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text); transition: transform 0.25s var(--ease);
}
.skill-row input.switch:checked { background: var(--accent); border-color: transparent; }
.skill-row input.switch:checked::after { transform: translateX(18px); background: var(--accent-ink); }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .split, .script-body, .conn-grid { grid-template-columns: 1fr; }
  .script-list { max-height: none; }
}
@media (max-width: 860px) {
  .field.search { width: 100%; }
  .stat-num { font-size: 32px; }
  .table .tr { font-size: 13px; }
}
