:root {
  --bg: #f5efe6;
  --bg-deep: #efe2d0;
  --ink: #1c1a17;
  --muted: #6a5f52;
  --accent: #f05d23;
  --accent-soft: #ffb07a;
  --card: #fff9f1;
  --card-border: rgba(88, 70, 52, 0.2);
  --shadow: 0 24px 80px rgba(34, 26, 18, 0.18);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Apple SD Gothic Neo", sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 800px at 10% -20%, #fff7ea, transparent),
    radial-gradient(900px 700px at 100% 0%, #ffe2c6, transparent),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
  min-height: 100vh;
}

.noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: multiply;
  z-index: 1;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: linear-gradient(120deg, rgba(240, 93, 35, 0.12), transparent 55%),
    linear-gradient(240deg, rgba(56, 129, 112, 0.14), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 2;
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: rise 0.8s ease-out;
}

.hero-note {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

.hero h1 {
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  margin: 0;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0;
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 620px;
}

.pill {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(240, 93, 35, 0.12);
  border: 1px solid rgba(240, 93, 35, 0.25);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #b34111;
}

.panel {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: rise 0.8s ease-out 0.1s both;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
}

.table-header h2 {
  margin: 0 0 4px;
}

.table-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.table-wrap {
  overflow-x: auto;
  padding: 16px 24px 24px;
}

#watch-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

#watch-table th:first-child,
#watch-table td:first-child {
  min-width: 220px;
}

#watch-table th,
#watch-table td {
  border: 1px solid rgba(28, 26, 23, 0.15);
  padding: 8px 12px;
  text-align: center;
  font-size: 0.9rem;
}

.cell-title {
  text-align: left;
}

#watch-table thead th {
  background: rgba(28, 26, 23, 0.04);
  font-weight: 600;
}

#watch-table tbody tr {
  cursor: pointer;
}

#watch-table tbody tr.active {
  outline: 2px solid rgba(240, 93, 35, 0.8);
  outline-offset: -2px;
}

.alert-row th {
  background: rgba(240, 93, 35, 0.08);
  font-size: 0.85rem;
}

.threshold {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

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

.threshold-label {
  font-size: 0.75rem;
  color: var(--muted);
  width: 32px;
  text-align: right;
}

.threshold label {
  font-size: 0.8rem;
  color: var(--muted);
}

.threshold-input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fffdf9;
  border: 1px solid rgba(88, 70, 52, 0.2);
  border-radius: 10px;
  padding: 2px 4px;
}

.threshold-input input {
  width: 48px;
  padding: 2px 2px;
  border: none;
  background: transparent;
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
}

.threshold-input input:focus {
  outline: none;
}

.cell-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  text-align: left;
}

.cell-muted {
  color: var(--muted);
}

.cell-warn {
  background: #f7f06b;
  font-weight: 600;
}

.cell-danger {
  background: #d77b74;
  color: #1c1a17;
  font-weight: 600;
}

.row-actions button {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 0.8rem;
  box-shadow: none;
  background: #b34111;
}

.search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 0.9rem;
  color: var(--muted);
}

input {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(88, 70, 52, 0.25);
  font-size: 1rem;
  background: #fffdf9;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 93, 35, 0.2);
}

button {
  padding: 14px 24px;
  border-radius: 16px;
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 24px rgba(240, 93, 35, 0.35);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(240, 93, 35, 0.45);
}

.status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
  color: var(--muted);
}

.badge {
  background: rgba(88, 70, 52, 0.12);
  color: #5f5245;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.results {
  display: grid;
  gap: 10px;
}

.result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.2s ease;
}

.result-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.add-btn {
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.8rem;
  box-shadow: none;
  background: #1f5b4d;
}

.add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(31, 91, 77, 0.25);
}

.result:hover {
  border-color: rgba(240, 93, 35, 0.4);
  background: rgba(255, 255, 255, 0.9);
}

.result.active {
  border-color: rgba(240, 93, 35, 0.9);
  background: rgba(240, 93, 35, 0.08);
}

.result strong {
  font-size: 1rem;
}

.result span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: rise 0.8s ease-out 0.2s both;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  color: var(--muted);
}

.card-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.2rem;
}

.ohlc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.ohlc-grid span,
.live-grid span,
.live-main .label {
  font-size: 0.85rem;
  color: var(--muted);
}

.ohlc-grid strong,
.live-grid strong,
.live-main strong {
  font-size: 1.2rem;
  font-weight: 600;
}

.live-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.live-main strong {
  font-size: 2rem;
}

.live-main .change {
  text-align: right;
}

.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.feed {
  gap: 12px;
}

.chart-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.chart-controls select {
  appearance: none;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(88, 70, 52, 0.25);
  background: #fffdf9;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
}

.chart-header h3 {
  margin: 0;
}

#chart-last {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  color: var(--muted);
}

.chart-canvas {
  position: relative;
  width: 100%;
  height: 320px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  border: 1px solid rgba(88, 70, 52, 0.12);
  overflow: hidden;
}

.chart-canvas canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.feed-header h3 {
  margin: 0;
}

.feed-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}

.feed-item {
  display: grid;
  grid-template-columns: 80px 1fr 1fr;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
}

.feed-item span:last-child {
  text-align: right;
}

.sub {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .live-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .feed-item {
    grid-template-columns: 1fr;
  }
}
