:root {
  --bg: #0b1220;
  --panel: #111c2e;
  --panel-soft: #16243a;
  --text: #e5ecf5;
  --muted: #9fb0c9;
  --line: #233650;
  --up: #2dd4bf;
  --down: #f87171;
  --chip: #1a2a43;
  --chip-active: #1f9fff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Pretendard", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.market-body {
  min-height: 100vh;
}

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #0f1a2b;
  padding: 18px 14px;
}

.sidebar h2 {
  margin: 4px 6px 12px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.side-link {
  width: 100%;
  text-align: center;
  border: 1px solid transparent;
  color: var(--text);
  background: transparent;
  border-radius: 8px;
  padding: 10px 10px;
  cursor: pointer;
  margin-bottom: 4px;
}

.side-link:hover {
  background: #15263d;
}

.side-link.active {
  background: #173a5d;
  border-color: #23598d;
}

.side-admin {
  display: inline-block;
  margin-top: 12px;
  width: 100%;
  text-align: center;
}

.content {
  padding: 20px;
}

.topbar {
  margin: 0 0 14px;
  padding: 4px 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.search-input {
  width: 260px;
  border: 1px solid var(--line);
  background: #0f1a2b;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
}

.side-search {
  width: 100%;
  margin-bottom: 12px;
}

.admin-btn {
  border: none;
  background: #15263d;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.container {
  max-width: 980px;
  margin: 0;
  padding: 10px 0 30px;
}

.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  border: none;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--chip);
  color: #1e293b;
  cursor: pointer;
}

.chip.active {
  background: var(--chip-active);
  color: #fff;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.sparkline {
  width: 72px;
  height: 22px;
}

.sparkline polyline {
  fill: none;
  stroke-width: 2;
}

.spark-up {
  stroke: var(--up);
}

.spark-down {
  stroke: var(--down);
}

.sparkline-empty {
  color: var(--muted);
  font-size: 12px;
}

.change {
  margin-top: 6px;
  font-weight: 600;
}

.recent3-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.recent3-cell .change {
  margin-top: 0;
}

.change.up {
  color: var(--up);
}

.change.down {
  color: var(--down);
}

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

thead th {
  background: #15263d;
  color: #c3d2e8;
}

.sort-btn {
  border: none;
  background: transparent;
  color: #c3d2e8;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  width: 100%;
  text-align: center;
}

.sort-btn.active {
  color: #ffffff;
}

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

tbody tr:hover {
  background: #15253b;
}

.admin-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}

.admin-panel h2 {
  margin: 0 0 6px;
}

.admin-help {
  margin: 0 0 14px;
  color: var(--muted);
}

.admin-rows {
  display: grid;
  gap: 12px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 12px;
}

.inline-form-items {
  grid-template-columns: 2fr 1fr 1fr auto;
}

.text-input {
  width: 100%;
  border: 1px solid #355179;
  background: #0f1a2b;
  color: var(--text);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px 6px 10px;
  background: #0f1a2b;
}

.tag-delete {
  border: 1px solid #3a4f6e;
  background: #1a2940;
  color: #c8d4e6;
  border-radius: 999px;
  font-size: 12px;
  padding: 2px 8px;
  cursor: pointer;
}

.tag-delete:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.admin-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.admin-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.delete-item-btn {
  border: 1px solid #5a2730;
  color: #fecaca;
  background: #3a1c25;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.admin-row h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.admin-grid label {
  font-size: 13px;
  color: #c3d2e8;
  display: grid;
  gap: 6px;
}

.admin-grid input,
.admin-grid select {
  width: 100%;
  border: 1px solid #355179;
  background: #0f1a2b;
  color: var(--text);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
}

.save-btn {
  margin-top: 14px;
  border: none;
  background: #1d4ed8;
  color: white;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}

.save-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: #2dd4bf;
  font-weight: 600;
}

.empty-row,
.empty-admin {
  color: var(--muted);
  text-align: center;
  padding: 18px;
}

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

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-input {
    width: 100%;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  th,
  td {
    font-size: 13px;
    padding: 10px;
  }
}
