/* Global Bond Agent - plain, readable styling. 13px is the smallest text
   size used anywhere on this site, on purpose - never go smaller. */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #1a1a1a;
  background: #f7f8fa;
}

h1, h2, h3 {
  font-family: inherit;
  color: #111;
}

.site-header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 12px;
}

.site-header h1 {
  font-size: 22px;
  margin: 0 0 6px;
}

.tagline {
  font-size: 14px;
  color: #444;
  max-width: 640px;
  margin: 0;
}

.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px;
  background: #fff;
  border-top: 1px solid #e2e2e2;
  border-bottom: 1px solid #e2e2e2;
  position: sticky;
  top: 0;
  z-index: 10;
}

.tab-btn {
  font-size: 13px;
  font-family: inherit;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #333;
  cursor: pointer;
}

.tab-btn:hover {
  background: #eef2fb;
}

.tab-btn.active {
  background: #2563eb;
  color: #fff;
}

.status-banner {
  padding: 8px 16px;
  font-size: 13px;
}

.status-ok {
  background: #e7f7ec;
  color: #1a7a3d;
}

.status-warn {
  background: #fff4e5;
  color: #7a4b00;
}

.tab-content {
  padding: 16px;
  max-width: 1100px;
  margin: 0 auto;
}

.panel-intro p {
  font-size: 14px;
  color: #333;
  max-width: 760px;
}

.card {
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.card h3 {
  font-size: 16px;
  margin: 0 0 8px;
}

.notice {
  background: #fff4e5;
  border: 1px solid #f5c88a;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #7a4b00;
  margin: 8px 0;
}

.muted {
  color: #777;
  font-size: 13px;
}

.unavailable {
  color: #999;
  font-style: italic;
  font-size: 13px;
}

/* Tables */

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

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

.data-table th,
.data-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}

.data-table th {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #777;
  cursor: pointer;
  user-select: none;
}

.data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table .total-row td {
  font-weight: 700;
  border-top: 2px solid #ddd;
}

.data-table .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  word-break: break-all;
  white-space: normal;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover,
.clickable-row:focus {
  background: #f2f6ff;
  outline: none;
}

/* Pills / action labels */

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.action-buy {
  background: #e7f7ec;
  color: #1a7a3d;
}

.action-sell {
  background: #fdeaea;
  color: #a3231f;
}

.action-hold {
  background: #eef0f3;
  color: #555;
}

/* Forms and controls */

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  align-items: flex-end;
}

.controls-row label,
.stack-form label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 4px;
  color: #333;
}

select,
input,
textarea {
  font-size: 14px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
  background: #fff;
  color: #1a1a1a;
}

textarea {
  resize: vertical;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 460px;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  align-self: flex-start;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-link {
  background: none;
  border: none;
  color: #a3231f;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* Stat tiles */

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0;
}

.stat-tile {
  background: #f7f8fa;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 150px;
  flex: 1 1 150px;
}

.stat-label {
  display: block;
  font-size: 13px;
  color: #777;
}

.stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: #111;
}

.stat-sub {
  display: block;
  font-size: 13px;
  color: #777;
  margin-top: 2px;
}

.detail-header h2 {
  font-size: 20px;
  margin: 0 0 2px;
}

/* Charts */

.chart-wrap {
  max-width: 100%;
  position: relative;
}

/* Signal / range bars */

.signal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.signal-row {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.signal-label {
  color: #333;
}

.signal-bar-track {
  position: relative;
  height: 10px;
  background: #eee;
  border-radius: 5px;
  overflow: hidden;
}

.signal-bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 5px;
}

.signal-positive {
  background: #34a853;
}

.signal-negative {
  background: #d93025;
}

.signal-neutral {
  background: #7a8ba6;
}

.signal-bar-empty {
  font-size: 13px;
  color: #999;
  font-style: italic;
  padding-left: 4px;
}

.signal-value {
  text-align: right;
  font-size: 13px;
  color: #333;
}

/* Term tooltips */

.term {
  border-bottom: 1px dotted #888;
  cursor: help;
  position: relative;
}

.term .term-tip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 130%;
  left: 0;
  background: #222;
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  width: 240px;
  z-index: 20;
  transition: opacity 0.15s;
  line-height: 1.4;
}

.term:hover .term-tip,
.term:focus .term-tip {
  visibility: visible;
  opacity: 1;
}

/* Ask box */

.ask-answer {
  margin-top: 12px;
  font-size: 14px;
  background: #f7f8fa;
  border-radius: 8px;
  padding: 12px;
  min-height: 20px;
  white-space: pre-wrap;
}

/* Loading / error states */

.loading-state {
  padding: 60px 16px;
  text-align: center;
  color: #555;
  font-size: 14px;
}

.site-footer {
  text-align: center;
  font-size: 13px;
  color: #888;
  padding: 24px 16px;
}

@media (max-width: 640px) {
  .signal-row {
    grid-template-columns: 1fr;
  }
  .signal-value {
    text-align: left;
  }
  .stat-tile {
    flex: 1 1 100%;
  }
  .data-table th,
  .data-table td {
    white-space: normal;
  }
}
