
/* ══════════════════════════════════════════════════════════════
   Dashboard enhancements — SPEC007 visual upgrade
   ══════════════════════════════════════════════════════════════ */

/* ── Balance widget ──────────────────────────────────────────── */

.balance-widget {
  background: linear-gradient(135deg, var(--brand) 0%, #8B7EF0 55%, #A78BFA 100%);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.balance-widget::before {
  content: '';
  position: absolute;
  top: -55px; right: -55px;
  width: 190px; height: 190px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  pointer-events: none;
}
.balance-widget::after {
  content: '';
  position: absolute;
  bottom: -45px; left: 5px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  pointer-events: none;
}
.balance-widget-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.75;
  margin-bottom: 0.5rem;
}
.balance-widget-amount {
  font-size: 2.4rem;
  font-weight: 800;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  position: relative;
  z-index: 1;
}
.balance-widget-reserved {
  font-size: 0.8rem;
  opacity: 0.65;
  margin-top: 0.45rem;
  position: relative;
  z-index: 1;
}
.balance-widget-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.balance-widget-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
  cursor: pointer;
  font-family: "IBM Plex Sans", sans-serif;
  white-space: nowrap;
}
.balance-widget-btn:hover {
  background: rgba(255,255,255,0.28);
  color: #fff;
  text-decoration: none;
}

/* ── Preset tiles ────────────────────────────────────────────── */

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.preset-tile {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: 9px;
  padding: 0.75rem 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s, box-shadow 0.15s;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 800;
  line-height: 1;
}
.preset-tile:hover {
  border-color: var(--brand);
  background: var(--brand-10);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--brand-15);
}
.preset-tile.selected {
  border-color: var(--brand);
  background: var(--brand-15);
  color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand-25), 0 4px 12px var(--brand-15);
}
.preset-tile-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.22rem;
  font-family: "IBM Plex Sans", sans-serif;
  display: block;
}
.preset-tile.selected .preset-tile-sub { color: var(--brand); opacity: 0.85; }

/* ── Transaction items ───────────────────────────────────────── */

.tx-list { display: flex; flex-direction: column; }
.tx-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.tx-item:last-child { border-bottom: none; }
.tx-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}
.tx-icon.credit { background: var(--success-15); }
.tx-icon.debit  { background: var(--surface-2); }
.tx-icon.warn   { background: var(--warning-15); }
.tx-info { flex: 1; min-width: 0; }
.tx-desc { font-size: 0.875rem; font-weight: 500; color: var(--text); }
.tx-meta { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.1rem; }
.tx-amount {
  font-weight: 700;
  font-size: 0.875rem;
  font-family: "JetBrains Mono", monospace;
  white-space: nowrap;
}
.tx-amount.positive { color: var(--success); }
.tx-amount.negative { color: var(--text-muted); }

/* ── API Key cards ───────────────────────────────────────────── */

.key-list { display: flex; flex-direction: column; gap: 0.6rem; }
.key-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.key-card:hover { border-color: rgba(94,106,210,0.4); box-shadow: var(--shadow-xs); }
.key-card.key-revoked { opacity: 0.5; }
.key-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.key-status-dot.is-active {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-15);
  animation: key-glow 2.5s infinite;
}
.key-status-dot.is-revoked { background: var(--danger); }
@keyframes key-glow {
  0%, 100% { box-shadow: 0 0 0 3px var(--success-15); }
  50%       { box-shadow: 0 0 0 5px rgba(38,194,129,0.05); }
}
.key-card-body { flex: 1; min-width: 0; }
.key-card-name { font-weight: 700; font-size: 0.9rem; color: var(--text); }
.key-card-meta {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 0.22rem;
}
.key-card-meta-item { font-size: 0.75rem; color: var(--text-muted); }
.key-prefix-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}
.key-prefix-chip:hover { color: var(--brand); border-color: var(--brand-25); }
.key-card-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

.key-scope-chip {
  display: inline-flex;
  align-items: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05rem 0.4rem;
  color: var(--text-muted);
}

.key-card-usage {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  flex-shrink: 0;
  padding-right: 1rem;
  margin-right: 0.25rem;
  border-right: 1px solid var(--border);
}
.key-card-usage-cost {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.key-card-usage-req {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}
@media (max-width: 768px) {
  .key-card-usage {
    border-right: none;
    align-items: flex-start;
    padding-right: 0;
    margin-right: 0;
  }
}

/* ── Limit info box ──────────────────────────────────────────── */

.limit-info-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
}
.limit-info-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.55rem;
  font-size: 0.82rem;
}
.limit-info-label { font-weight: 600; color: var(--text); }
.limit-info-value { color: var(--text-muted); font-family: "JetBrains Mono", monospace; font-size: 0.75rem; }

/* ── Alert items ─────────────────────────────────────────────── */

.alert-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  margin-bottom: 0.4rem;
}
.alert-item:last-child { margin-bottom: 0; }
.alert-item-left { display: flex; align-items: center; gap: 0.6rem; }
.alert-item-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--brand-10);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.alert-item-label { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.alert-item-sub   { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.05rem; }

/* ── Alert type picker (nueva alerta) ────────────────────────── */

.alert-type-picker {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.alert-type-opt {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.alert-type-opt:hover { border-color: var(--brand-25); }
.alert-type-opt:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-10);
}
.alert-type-opt input[type="radio"] {
  margin-top: 0.2rem;
  accent-color: var(--brand);
  flex-shrink: 0;
}
.alert-type-icon { font-size: 0.95rem; line-height: 1.3; flex-shrink: 0; }
.alert-type-body { min-width: 0; }
.alert-type-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text); }
.alert-type-desc  { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.1rem; }

/* ── Limits protection status strip ──────────────────────────── */

.limits-status-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.limits-status-strip .acct-stat:last-child { border-right: none; }
@media (max-width: 680px) {
  .limits-status-strip { grid-template-columns: 1fr; }
  .limits-status-strip .acct-stat { border-right: none; border-bottom: 1px solid var(--border); }
  .limits-status-strip .acct-stat:last-child { border-bottom: none; }
}

/* ── Overview widgets (dashboard home) ───────────────────────── */

.ov-widgets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 820px) { .ov-widgets { grid-template-columns: 1fr; } }
.ov-widget { padding: 1.25rem 1.25rem 1rem; display: flex; flex-direction: column; }
.ov-widget-label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.ov-widget-foot { display: flex; align-items: baseline; }
.ov-model-list { display: flex; flex-direction: column; gap: 0.65rem; margin-top: 0.9rem; flex: 1; }
.ov-model-row { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 0.5rem; }
.ov-model-name { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.ov-model-bar-wrap { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.ov-model-bar { height: 100%; width: 0; background: var(--brand); border-radius: 2px; transition: width 0.6s cubic-bezier(.22,1,.36,1); }
.ov-model-count { font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: right; min-width: 1.5rem; }
.ov-spend-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.9rem; }
.ov-spend-row { display: grid; grid-template-columns: 5.5rem 1fr auto; align-items: center; gap: 0.5rem; }
.ov-spend-label { font-size: 0.8125rem; color: var(--text-muted); white-space: nowrap; }
.ov-spend-bar-wrap { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.ov-spend-bar { height: 100%; width: 0; border-radius: 2px; transition: width 0.7s cubic-bezier(.22,1,.36,1); }
.ov-spend-input  { background: var(--success); }
.ov-spend-output { background: var(--brand); }
.ov-spend-warning { background: var(--warning); }
.ov-spend-danger  { background: var(--danger); }
.ov-spend-pct { font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 2.5rem; text-align: right; }
@media (prefers-reduced-motion: reduce) { .ov-model-bar, .ov-spend-bar { transition: none; } }

/* ── Model usage breakdown (usage page) ─────────────────────── */

.model-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.model-row:last-child { border-bottom: none; }
.model-row-name {
  flex-shrink: 0;
  width: 190px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-row-bar-track {
  flex: 1;
  background: var(--surface-2);
  border-radius: 999px;
  height: 5px;
  overflow: hidden;
}
.model-row-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand) 0%, #8B7EF0 100%);
  transition: width 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.model-row-count {
  flex-shrink: 0;
  width: 28px;
  text-align: right;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.model-row-cost {
  flex-shrink: 0;
  width: 72px;
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: "JetBrains Mono", monospace;
}

/* ── Latency badges ──────────────────────────────────────────── */

.lat-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-family: "JetBrains Mono", monospace;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
}
.lat-fast { background: var(--success-15); color: var(--success); }
.lat-mid  { background: var(--warning-15); color: var(--warning); }
.lat-slow { background: var(--danger-15);  color: var(--danger); }

/* ── Overview: stepper onboarding ───────────────────────────── */

.qs-track {
  display: flex;
  align-items: flex-start;
  gap: 0;
  position: relative;
  padding: 0.25rem 0 1.5rem;
}

/* Horizontal connector line between nodes */
.qs-track::before {
  content: '';
  position: absolute;
  top: 25px;
  left: calc(16.66% + 0px);
  right: calc(16.66% + 0px);
  height: 1px;
  background: linear-gradient(90deg,
    var(--border) 0%,
    var(--border) 100%
  );
  z-index: 0;
}

.qs-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
  position: relative;
  z-index: 1;
  padding: 0 0.4rem;
  transition: opacity 0.15s;
  cursor: pointer;
}
.qs-step[href]:hover { opacity: 0.82; text-decoration: none; color: var(--text); }

/* Node circle */
.qs-node {
  width: 50px; height: 50px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 800;
  font-weight: 800;
  font-size: 1rem;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
  position: relative;
}
.qs-step[href]:hover .qs-node { transform: translateY(-3px); }

.qs-step.qs-done .qs-node {
  background: var(--success-15);
  border: 2px solid var(--success);
  color: var(--success);
  box-shadow: 0 0 0 5px rgba(38,194,129,0.06);
}
.qs-step.qs-active .qs-node {
  background: var(--brand-15);
  border: 2px solid var(--brand);
  color: var(--brand);
  animation: qs-glow 2.8s ease-in-out infinite;
}
@keyframes qs-glow {
  0%, 100% { box-shadow: 0 0 0 4px var(--brand-10), 0 4px 18px var(--brand-15); }
  50%       { box-shadow: 0 0 0 7px rgba(94,106,210,0.05), 0 4px 28px rgba(94,106,210,0.12); }
}
.qs-step.qs-todo .qs-node {
  background: var(--surface-2);
  border: 1.5px dashed var(--border);
  color: var(--text-muted);
}

/* Check icon inside done node */
.qs-checkmark {
  width: 18px; height: 18px;
}

/* Body text */
.qs-body { text-align: center; }
.qs-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.qs-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.35;
}
.qs-step.qs-todo .qs-title { color: var(--text-muted); font-weight: 500; }
.qs-step.qs-active .qs-title { color: var(--brand); }

/* Progress bar beneath the stepper */
.qs-bar-wrap {
  height: 2px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 0 1.5rem;
}
.qs-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--success) 0%, var(--brand) 100%);
  transition: width 0.7s cubic-bezier(0.16,1,0.3,1);
}

/* ── Billing: denomination selector ──────────────────────────── */

.amount-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}
.amount-tile {
  position: relative;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 0.5rem 0.9rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.15s, box-shadow 0.18s, background 0.18s;
  overflow: hidden;
  user-select: none;
}
/* Subtle top-left gloss */
.amount-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(255,255,255,0.035) 0%, transparent 55%);
  pointer-events: none;
  border-radius: inherit;
}
.amount-tile:hover {
  border-color: var(--brand);
  background: var(--bg);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(94,106,210,0.16), 0 2px 6px rgba(0,0,0,0.1);
}
.amount-tile:active { transform: translateY(-1px); }
.amount-tile.selected {
  border-color: var(--brand);
  background: var(--brand-10);
  box-shadow: 0 0 0 1px var(--brand-25), 0 8px 24px rgba(94,106,210,0.2);
}
/* Floating checkmark */
.amount-tile-check {
  position: absolute;
  top: 7px; right: 8px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transform: scale(0.4) rotate(-15deg);
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.amount-tile.selected .amount-tile-check {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}
.amount-tile-check svg { display: block; }
/* Currency + number */
.amount-tile-currency {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  vertical-align: 0.55em;
  line-height: 1;
  font-family: "IBM Plex Sans", sans-serif;
  margin-right: 1px;
}
.amount-tile-number {
  font-size: 1.65rem;
  font-weight: 800;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}
.amount-tile.selected .amount-tile-number { color: var(--brand); }
.amount-tile.selected .amount-tile-currency { color: var(--brand); opacity: 0.75; }
.amount-tile-label {
  font-size: 0.70rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-weight: 500;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  display: block;
}
.amount-tile.selected .amount-tile-label { color: var(--brand); opacity: 0.75; }
