:root {
  --bg: #090b10;
  --panel: #121723;
  --panel-alt: #171e2b;
  --border: #2b3448;
  --text: #f2f5ff;
  --muted: #a4adc3;
  --accent: #43d3ff;
  --accent-2: #67f5a9;
  --danger: #ff6b6b;
  --row-hover: #1f2838;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, #1b2a46 0%, rgba(9, 11, 16, 0) 38%),
    radial-gradient(circle at 85% 0%, #122a32 0%, rgba(9, 11, 16, 0) 30%),
    var(--bg);
  min-height: 100vh;
  font-family: "Segoe UI", "SF Pro Text", "Helvetica Neue", sans-serif;
}

.app-shell {
  width: min(1480px, 96vw);
  margin: 0 auto;
  padding: 20px 0 32px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0.03em;
}

h2 {
  margin: 0;
  font-size: 1.12rem;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
}

.health {
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.9rem;
}

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

.panel {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-alt) 100%);
  border-radius: 14px;
  padding: 14px;
  min-height: 70vh;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.ticker-form {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.ticker-form input,
.ticker-form button,
select {
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #0f1420;
  color: var(--text);
  height: 40px;
}

.ticker-form input {
  flex: 1;
  padding: 0 12px;
  font-size: 1rem;
}

.ticker-form button {
  background: linear-gradient(90deg, #124766, #1d7a5a);
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
}

.ticker-form button:hover,
.add-btn:hover {
  filter: brightness(1.15);
}

.watched {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.chip {
  border: 1px solid #355379;
  color: #b6d8ff;
  background: #122136;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

.chain-controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
}

.status {
  margin: 8px 0 10px;
  color: var(--muted);
  min-height: 20px;
}

.hidden {
  display: none;
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
  max-height: 70vh;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0f1420;
  text-align: right;
  border-bottom: 1px solid var(--border);
  color: #9cb8de;
  padding: 9px 8px;
}

thead th:first-child,
thead th:nth-child(2),
thead th:nth-child(3) {
  text-align: left;
}

tbody td {
  padding: 8px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: right;
}

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

tbody td:first-child,
tbody td:nth-child(2),
tbody td:nth-child(3) {
  text-align: left;
}

.empty {
  text-align: center !important;
  color: var(--muted);
  padding: 18px 8px;
}

.type-call {
  color: #85d7ff;
  font-weight: 700;
}

.type-put {
  color: #ff96a6;
  font-weight: 700;
}

.add-btn,
.remove-btn {
  border-radius: 7px;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.add-btn {
  background: linear-gradient(90deg, #224f6f, #276153);
  padding: 6px 10px;
}

.remove-btn {
  background: #4d1e2b;
  border-color: #703345;
  color: #ffccd2;
  padding: 6px 10px;
}

.portfolio-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.portfolio-card,
.empty-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #111824;
  padding: 12px;
}

.empty-card {
  color: var(--muted);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.contract-title {
  margin: 0;
  font-size: 1.04rem;
}

.contract-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.quote-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  font-size: 0.86rem;
  color: var(--muted);
}

.quote-row strong {
  color: var(--text);
}

.spark {
  width: 100%;
  height: 160px;
  margin-top: 8px;
  background: linear-gradient(180deg, #0f1726 0%, #0c1321 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .ticker-form {
    flex-direction: column;
  }

  .ticker-form button {
    width: 100%;
  }

  .quote-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
