/* FTX-inspired dark trading UI
   Navy background, cyan accent, raised cards. */
:root {
  --bg: #0e1a2a;
  --bg-deep: #0a1320;
  --bg-raised: #1a2438;
  --bg-raised-2: #22304a;
  --bg-input: #131d30;
  --bg-hover: #243146;
  --border: #2a3548;
  --border-strong: #3a4562;
  --text: #ffffff;
  --text-dim: #b4bcc9;
  --text-muted: #7d8a9c;
  --accent: #11cdef;
  --accent-bright: #2fdcff;
  --accent-dim: #0891b2;
  --success: #4ade80;
  --danger: #ff5370;
  --warn: #fbc02d;
  --radius: 4px;
  --radius-lg: 8px;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Critical: native [hidden] must beat form { display: flex } */
[hidden] {
  display: none !important;
}

/* Top navigation bar */
.topbar {
  display: flex;
  align-items: center;
  padding: 14px 32px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.brand-dot {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--accent);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

header {
  margin-bottom: 24px;
}

h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.subtitle {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 0 4px;
}

.tab {
  background: transparent;
  color: var(--text-dim);
  border: none;
  padding: 14px 22px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin: 0;
  border-radius: 0;
  transition: color 0.12s, border-color 0.12s;
}

.tab:hover:not(.active) {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Form panels */
form.tab-form {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.tab-intro {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 4px;
  line-height: 1.6;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 620px) {
  .row {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 12px 16px;
  }
  main {
    padding: 20px 16px 60px;
  }
  form.tab-form {
    padding: 20px 18px;
  }
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lbl {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

.req {
  color: var(--danger);
  margin-left: 3px;
}

.req-soft {
  color: var(--warn);
  margin-left: 3px;
}

input, select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 13px;
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  width: 100%;
  transition: border-color 0.1s, background 0.1s;
}

input:hover, select:hover {
  border-color: var(--border-strong);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-deep);
  box-shadow: 0 0 0 2px rgba(17, 205, 239, 0.15);
}

input::placeholder {
  color: var(--text-muted);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%237d8a9c' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 32px;
}

.hint {
  font-size: 11px;
  color: var(--text-muted);
  padding-left: 1px;
}

.range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.range input {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.range-sep {
  color: var(--text-muted);
  font-size: 12px;
}

.help-inline {
  color: var(--text-dim);
  font-size: 12px;
  margin: 0;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  line-height: 1.55;
}

.help-inline strong {
  color: var(--accent);
  font-weight: 600;
}

/* FTX-style cyan button */
button[type="submit"] {
  background: var(--accent);
  color: #001824;
  border: none;
  padding: 13px 24px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.1s, transform 0.05s, box-shadow 0.1s;
  font-family: var(--font-sans);
  box-shadow: 0 2px 8px rgba(17, 205, 239, 0.2);
}

button[type="submit"]:hover:not(:disabled) {
  background: var(--accent-bright);
  box-shadow: 0 2px 12px rgba(17, 205, 239, 0.35);
}

button[type="submit"]:active:not(:disabled) {
  transform: translateY(1px);
}

button[type="submit"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Status line */
#status {
  margin-top: 20px;
  color: var(--text-dim);
  font-size: 13px;
  min-height: 1.5em;
  padding: 0 2px;
}

#status.error {
  color: var(--danger);
}

/* Results table */
#results {
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-raised-2);
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg-hover);
}

/* Numeric columns get mono + tabular-nums */
td:nth-child(1),
td:nth-child(4),
td:nth-child(5),
td:nth-child(6) {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

td.addr {
  font-family: var(--font-mono);
  font-size: 11px;
}

td.addr a {
  color: var(--accent);
  text-decoration: none;
}

td.addr a:hover {
  color: var(--accent-bright);
  text-decoration: underline;
}

.copy-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: var(--radius);
  font-size: 10px;
  cursor: pointer;
  margin-left: 8px;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
  letter-spacing: 0.03em;
}

/* Dark color-scheme for native date/time/number inputs */
input[type="date"],
input[type="time"],
input[type="number"] {
  color-scheme: dark;
  font-family: var(--font-mono);
}
