/* Style transplanted from the bittensor.com website (subtensor/website):
   Haffer body type, FiraCode uppercase mono labels, white ground,
   #2f46f4 primary blue, hairline solid + dashed separators. */

@font-face {
  font-family: 'Haffer';
  src: url(/static/fonts/Haffer-Light.ttf);
  font-weight: 200;
  font-style: normal;
}
@font-face {
  font-family: 'Haffer';
  src: url(/static/fonts/Haffer-Medium.ttf);
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: 'Haffer';
  src: url(/static/fonts/Haffer-Regular.ttf);
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: 'Haffer';
  src: url(/static/fonts/Haffer-SemiBold.ttf);
  font-weight: bold;
  font-style: normal;
}
@font-face {
  font-family: 'FiraCode';
  src: url(/static/fonts/FiraCode_VariableFont_wght.ttf);
}
@font-face {
  font-family: 'DM Mono';
  src: url(/static/fonts/DMMono-Regular.ttf);
}

:root {
  --white: #fff;
  --grey-100: #f8f9fa;
  --grey-200: #f1f3f4;
  --grey-300: #dbdde1;
  --grey-400: #bdc1c6;
  --grey-500: #5f6368;
  --grey-900: #0e1013;

  --background-default: #fff;
  --background-paper: #fff;
  --text-primary: #292929;
  --text-secondary: var(--grey-500);
  --primary-main: #2f46f4;
  --primary-light: #4257f5;
  --primary-contrastText: #ffffff;
  --success-main: #49c24e;
  --error-main: #d93737;
  --warning-main: #eeac3c;
  --border-solid: var(--grey-300);
  --border-dashed: var(--grey-900);
  --highlight: #e9f4a4;

  --mono: 'FiraCode', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background-color: var(--background-default);
  color: var(--text-primary);
  font-family: 'Haffer', sans-serif;
  font-weight: 200;
  font-size: 15px;
  line-height: 180%;
  letter-spacing: 0.03em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* 1px dashed hairline, as used across bittensor.com */
.dashed {
  position: relative;
}
.dashed::after {
  content: '';
  background-image: linear-gradient(to right, var(--border-dashed), 1px, transparent 1px);
  background-repeat: repeat-x;
  background-size: 6px 1px;
  display: block;
  width: 100%;
  height: 1px;
  position: absolute;
  bottom: 0;
  left: 0;
}

/* header */
.topbar {
  position: sticky;
  top: 0;
  background-color: var(--background-default);
  z-index: 100;
  width: 100%;
}
.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  height: 60px;
  width: 100%;
  max-width: 1200px;
  margin: auto;
}

.brand {
  font-family: var(--mono);
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: 0.06em;
}
.brand-dot { color: var(--primary-main); }

nav { display: flex; align-items: center; gap: 24px; }
.nav-user {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-secondary);
}
.nav-link {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-primary);
  text-decoration: none;
}
.nav-link:hover { color: var(--primary-main); }

.page {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 20px;
}

.dashed-top {
  position: relative;
}
.dashed-top::before {
  content: '';
  background-image: linear-gradient(to right, var(--border-dashed), 1px, transparent 1px);
  background-repeat: repeat-x;
  background-size: 6px 1px;
  display: block;
  width: 100%;
  height: 1px;
  position: absolute;
  top: 0;
  left: 0;
}

.footer {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-secondary);
  padding: 24px;
}

/* type */
h1 {
  font-weight: 400;
  font-size: 34px;
  line-height: 140%;
  letter-spacing: 0.01em;
  margin: 0 0 8px;
}
h2 {
  font-weight: 400;
  font-size: 20px;
  margin: 0;
}
h1 em { font-style: normal; color: var(--primary-main); }

code {
  font-family: 'DM Mono', var(--mono);
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-all;
}

/* landing */
.hero {
  text-align: center;
  padding-top: 10vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero .sub {
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 48px;
  font-size: 15px;
}

.login-card {
  border: 1px solid var(--border-solid);
  border-radius: 5px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  background: var(--background-paper);
}

.dev-login { display: flex; flex-direction: column; gap: 12px; }

input[type="email"], input[type="text"] {
  background: var(--background-paper);
  border: 1px solid var(--border-solid);
  border-radius: 5px;
  color: var(--text-primary);
  padding: 10px 14px;
  font-family: 'Haffer', sans-serif;
  font-weight: 200;
  font-size: 14px;
  letter-spacing: 0.03em;
  outline: none;
}
input:focus { border-color: var(--primary-main); }
input::placeholder { color: var(--grey-400); }

/* buttons: FiraCode 12px, fill blue on hover — CtaButton.module.css */
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  border: 1px solid var(--border-solid);
  background-color: var(--background-paper);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  transition: all 0.5s ease;
}
.btn:hover {
  border-color: var(--primary-light);
  background-color: var(--primary-light);
  color: var(--background-default);
}
.btn-primary {
  border-color: var(--text-primary);
}
.btn-google {
  width: 100%;
  border-color: var(--text-primary);
}
.btn-danger { color: var(--error-main); }
.btn-danger:hover {
  border-color: var(--error-main);
  background-color: var(--error-main);
  color: var(--white);
}
.btn-tiny { padding: 2px 10px; font-size: 11px; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 18px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-image: linear-gradient(to right, var(--border-dashed), 1px, transparent 1px);
  background-repeat: repeat-x;
  background-size: 6px 1px;
}

.hint { color: var(--text-secondary); font-size: 13px; margin-top: 16px; }
.error { color: var(--error-main); }
.empty {
  color: var(--text-secondary);
  padding: 48px 0;
  text-align: center;
}

/* dashboard */
.dash-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 40px;
  padding-bottom: 24px;
  position: relative;
}
.dash-head::after {
  content: '';
  background-image: linear-gradient(to right, var(--border-dashed), 1px, transparent 1px);
  background-repeat: repeat-x;
  background-size: 6px 1px;
  display: block;
  width: 100%;
  height: 1px;
  position: absolute;
  bottom: 0;
  left: 0;
}
.dash-head h1 { font-size: 24px; margin: 0; }
.create-form { display: flex; gap: 10px; flex-wrap: wrap; }
.create-form input[name="model"] { width: 240px; }

.agent-table {
  border: 1px solid var(--border-solid);
  border-radius: 5px;
  margin-bottom: 24px;
  overflow: hidden;
}

.agent-row {
  display: grid;
  grid-template-columns:
    minmax(180px, 1.5fr) 92px minmax(230px, 2fr) minmax(130px, 1.3fr)
    92px 150px;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-solid);
}
.agent-row:hover { background: var(--grey-100); }

.agent-row-head {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 10px 20px;
  border-top: none;
  background: var(--grey-100);
}
.agent-row-head:hover { background: var(--grey-100); }

.agent-table-foot {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 10px 20px;
  border-top: 1px solid var(--border-solid);
}

.cell {
  min-width: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-name .name {
  display: block;
  font-size: 15px;
  color: var(--text-primary);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-name .name:hover { color: var(--primary-main); }

/* the name link covers the row, so clicking anywhere opens the agent */
.agent-row { position: relative; }
.cell-name .name::after {
  content: '';
  position: absolute;
  inset: 0;
}
.agent-row .btn,
.agent-row form,
.agent-row .key { position: relative; z-index: 1; }
.cell-name .key {
  font-size: 12px;
  color: var(--text-secondary);
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .agent-row-head { display: none; }
  .agent-row { display: block; }
  .cell {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 0;
  }
  .cell code { flex: 1; }
  .cell-name { display: block; margin-bottom: 8px; }
  .cell[data-label]::before {
    content: attr(data-label);
    flex: 0 0 80px;
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
  }
  .row-actions {
    justify-content: flex-start;
    margin-top: 10px;
  }
}

.status {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: 5px;
  border: 1px solid var(--border-solid);
  color: var(--text-secondary);
}
.status-running { color: var(--success-main); border-color: var(--success-main); }
.status-missing, .status-exited, .status-dead {
  color: var(--error-main);
  border-color: var(--error-main);
}

.key-row { display: flex; gap: 8px; align-items: center; }
.key-row .key { min-width: 0; }

/* agent detail */
.back-link {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 16px;
}
.back-link:hover { color: var(--primary-main); }

.agent-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.agent-title h1 { font-size: 24px; margin: 0; }
.muted-mono {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.head-actions { display: flex; gap: 10px; align-items: center; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.tile {
  border: 1px solid var(--border-solid);
  border-radius: 5px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tile .tile-foot { margin-top: auto; }
.tile-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.tile-value { font-size: 26px; line-height: 120%; }
.tile-foot {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meter {
  height: 4px;
  border-radius: 2px;
  background: var(--grey-200);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  background: var(--primary-main);
  transition: width 0.4s ease;
}

.panel {
  border-top: 1px solid var(--border-solid);
  padding: 24px 0;
}
.panel-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.kv {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 6px 16px;
  margin: 0;
  font-size: 13px;
}
.kv dt {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv a { color: var(--primary-main); }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 160px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-solid);
}
.chart-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}
.chart-bar {
  width: 100%;
  min-height: 2px;
  background: var(--primary-main);
  border-radius: 2px 2px 0 0;
}
.chart-col:hover .chart-bar { background: var(--primary-light); }
.chart-tick {
  position: absolute;
  bottom: -18px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-secondary);
}

.cursor-help { margin-top: 8px; }
.cursor-help summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.cursor-help summary:hover { color: var(--primary-main); }
.cursor-help ol {
  font-size: 13px;
  color: var(--text-secondary);
  padding-left: 20px;
}

/* Connect-a-client steps: each step is prose plus the thing to copy. */
.setup {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}
.setup li { margin-bottom: 14px; }
.setup li:last-child { margin-bottom: 0; }
.setup li > span { display: block; margin-bottom: 6px; }
.setup .key-row .key { white-space: pre-line; }
.setup a { color: var(--primary-main); }

/* admin */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 48px;
}
.table th, .table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-solid);
}
.table th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--text-secondary);
}

::selection { background: var(--highlight); }
