/* ==========================================================================
   laser-helius control center — design system on top of Tailwind CDN
   Dark-first, glass-morphism, accent = emerald/teal. No external assets.
   ========================================================================== */

:root {
  --accent: 16 185 129;       /* emerald-500 */
  --accent-soft: 16 185 129 / 0.15;
  --danger: 244 63 94;        /* rose-500 */
  --warn: 245 158 11;         /* amber-500 */
  --info: 59 130 246;         /* blue-500 */
  --surface: 15 23 42 / 0.6;
  --surface-2: 30 41 59 / 0.4;
  --border: 51 65 85 / 0.5;
}

html { font-feature-settings: "cv11", "ss01", "ss03"; }
body { font-optical-sizing: auto; }

*::selection { background: rgb(16 185 129 / 0.3); color: white; }

/* ============================= Layout ============================= */

.glass-card {
  border-radius: 1rem;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--surface));
  backdrop-filter: blur(12px);
  padding: 1.25rem;
  transition: border-color 0.2s, transform 0.2s;
}
.glass-card:hover { border-color: rgb(51 65 85 / 0.8); }
.glass-card.group:hover { transform: translateY(-1px); }

/* ============================= Sidebar nav ============================= */

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(148 163 184);
  transition: background 0.15s, color 0.15s;
  text-align: left;
}
.nav-item:hover {
  background: rgb(30 41 59 / 0.5);
  color: rgb(226 232 240);
}
.nav-item.nav-active {
  background: rgb(16 185 129 / 0.1);
  color: rgb(52 211 153);
  box-shadow: inset 2px 0 0 rgb(16 185 129);
}
.nav-item.nav-active svg { color: rgb(52 211 153); }

.nav-badge {
  margin-left: auto;
  min-width: 1.5rem;
  padding: 0.125rem 0.375rem;
  border-radius: 9999px;
  background: rgb(30 41 59 / 0.8);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.625rem;
  font-weight: 500;
  text-align: center;
  color: rgb(148 163 184);
}
.nav-item.nav-active .nav-badge {
  background: rgb(16 185 129 / 0.2);
  color: rgb(52 211 153);
}

/* ============================= Stat cards ============================= */

.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgb(148 163 184);
  letter-spacing: 0.025em;
}
.stat-value {
  margin-top: 0.75rem;
  font-size: 1.875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.stat-foot {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: rgb(100 116 139);
  font-variant-numeric: tabular-nums;
}
.stat-value.pnl-positive { color: rgb(52 211 153); }
.stat-value.pnl-negative { color: rgb(251 113 133); }

/* ============================= Forms ============================= */

.input-field {
  width: 100%;
  margin-top: 0.375rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgb(51 65 85 / 0.8);
  border-radius: 0.5rem;
  background: rgb(15 23 42);
  color: rgb(241 245 249);
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.input-field:focus {
  border-color: rgb(16 185 129);
  box-shadow: 0 0 0 3px rgb(16 185 129 / 0.15);
}
.input-field::placeholder { color: rgb(71 85 105); }

textarea.input-field { resize: vertical; min-height: 72px; }

.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgb(203 213 225);
  letter-spacing: 0.01em;
}
.field-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.6875rem;
  color: rgb(100 116 139);
}

/* Toggle switch */
.toggle-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgb(51 65 85 / 0.5);
  border-radius: 0.5rem;
  background: rgb(15 23 42 / 0.4);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.toggle-field:hover {
  border-color: rgb(71 85 105);
  background: rgb(15 23 42 / 0.7);
}
input.switch {
  appearance: none;
  position: relative;
  width: 2.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  background: rgb(51 65 85);
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
input.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: 1rem;
  border-radius: 9999px;
  background: white;
  transition: transform 0.2s;
}
input.switch:checked { background: rgb(16 185 129); }
input.switch:checked::after { transform: translateX(1rem); }

/* ============================= Buttons ============================= */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 0.875rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, rgb(16 185 129), rgb(5 150 105));
  font-size: 0.875rem;
  font-weight: 500;
  color: white;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.3), inset 0 1px 0 rgb(255 255 255 / 0.1);
  transition: transform 0.1s, box-shadow 0.1s, opacity 0.1s;
}
.btn-primary:hover { box-shadow: 0 2px 6px rgb(16 185 129 / 0.3), inset 0 1px 0 rgb(255 255 255 / 0.15); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 2.25rem;
  padding: 0 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid rgb(51 65 85 / 0.6);
  background: transparent;
  color: rgb(203 213 225);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s;
}
.btn-ghost:hover { background: rgb(30 41 59 / 0.5); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 2.25rem;
  padding: 0 0.875rem;
  border-radius: 0.5rem;
  background: rgb(244 63 94);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s;
}
.btn-danger:hover { background: rgb(225 29 72); }

.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid rgb(244 63 94 / 0.3);
  border-radius: 0.375rem;
  background: rgb(244 63 94 / 0.1);
  color: rgb(251 113 133);
  font-size: 0.75rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.btn-danger-outline:hover {
  background: rgb(244 63 94 / 0.2);
  border-color: rgb(244 63 94 / 0.6);
}

/* ============================= Badges ============================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.025em;
  font-variant-numeric: tabular-nums;
}
.badge-buy {
  background: rgb(16 185 129 / 0.15);
  color: rgb(52 211 153);
  border: 1px solid rgb(16 185 129 / 0.3);
}
.badge-sell {
  background: rgb(59 130 246 / 0.15);
  color: rgb(96 165 250);
  border: 1px solid rgb(59 130 246 / 0.3);
}
.badge-failed {
  background: rgb(244 63 94 / 0.15);
  color: rgb(251 113 133);
  border: 1px solid rgb(244 63 94 / 0.3);
}
.badge-submitted {
  background: rgb(245 158 11 / 0.15);
  color: rgb(251 191 36);
  border: 1px solid rgb(245 158 11 / 0.3);
}
.badge-confirmed {
  background: rgb(16 185 129 / 0.15);
  color: rgb(52 211 153);
  border: 1px solid rgb(16 185 129 / 0.3);
}

/* ============================= Tables ============================= */

tbody tr {
  transition: background 0.1s;
}
tbody tr:hover {
  background: rgb(30 41 59 / 0.3);
}
tbody td {
  padding: 0.75rem;
  font-size: 0.875rem;
  vertical-align: middle;
}

/* ============================= Toasts ============================= */

.toast {
  padding: 0.875rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid;
  background: rgb(15 23 42 / 0.95);
  backdrop-filter: blur(12px);
  color: rgb(241 245 249);
  font-size: 0.875rem;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.5);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
  display: flex;
  align-items: start;
  gap: 0.625rem;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.toast-ok { border-color: rgb(16 185 129 / 0.3); }
.toast.toast-ok::before {
  content: "";
  flex-shrink: 0;
  width: 1.125rem; height: 1.125rem;
  background-color: rgb(52 211 153);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'><path stroke-linecap='round' stroke-linejoin='round' d='M5 13l4 4L19 7'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'><path stroke-linecap='round' stroke-linejoin='round' d='M5 13l4 4L19 7'/></svg>") center/contain no-repeat;
}
.toast.toast-err { border-color: rgb(244 63 94 / 0.3); }
.toast.toast-err::before {
  content: "";
  flex-shrink: 0;
  width: 1.125rem; height: 1.125rem;
  background-color: rgb(251 113 133);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'><path stroke-linecap='round' stroke-linejoin='round' d='M12 9v2m0 4h.01M10.3 3.6c.8-1.4 2.7-1.4 3.4 0l7.4 13.6c.8 1.3-.2 3-1.7 3H4.6c-1.5 0-2.5-1.7-1.7-3L10.3 3.6z'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'><path stroke-linecap='round' stroke-linejoin='round' d='M12 9v2m0 4h.01M10.3 3.6c.8-1.4 2.7-1.4 3.4 0l7.4 13.6c.8 1.3-.2 3-1.7 3H4.6c-1.5 0-2.5-1.7-1.7-3L10.3 3.6z'/></svg>") center/contain no-repeat;
}

/* ============================= Modal ============================= */

#modal.show { display: flex; }
#modal .glass-card { animation: modalPop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============================= Misc ============================= */

/* Spinning refresh icon */
.spin { animation: spin 0.6s linear; }
@keyframes spin {
  to { transform: rotate(360deg); }
}

.nav-link:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Panel fade */
.panel { animation: panelIn 0.2s ease-out; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgb(51 65 85 / 0.6);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgb(71 85 105); }

/* Position row token & owner mono text */
.cell-mono { font-family: "JetBrains Mono", monospace; font-size: 0.75rem; color: rgb(203 213 225); }
.cell-mono-dim { font-family: "JetBrains Mono", monospace; font-size: 0.75rem; color: rgb(148 163 184); }

/* Whale item */
.whale-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
}
.whale-item:first-child { padding-top: 0; }
.whale-item:last-child { padding-bottom: 0; }

/* Empty states */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: rgb(100 116 139);
  font-size: 0.875rem;
}
.empty-state svg {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 0.75rem;
  color: rgb(71 85 105);
}

/* Recent trade row */
.trade-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  transition: background 0.15s;
}
.trade-row:hover { background: rgb(30 41 59 / 0.4); }
