:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #18212f;
  --muted: #657386;
  --line: #d9e0e7;
  --blue: #2563eb;
  --green: #0f8f67;
  --red: #c2413a;
  --amber: #b06f00;
  --ink: #0f172a;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #111827;
  color: #f8fafc;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #e9f0ff;
  color: #1d4ed8;
  font-weight: 800;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
}

.brand p {
  margin-top: 3px;
  color: #aeb8c7;
  font-size: 12px;
}

nav {
  display: grid;
  gap: 6px;
}

nav a {
  color: #d7deeb;
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.quote-status {
  position: absolute;
  right: 18px;
  bottom: 20px;
  left: 18px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 12px;
}

main {
  min-width: 0;
  padding: 26px;
}

.topbar,
.panel-heading,
.form-actions,
.topbar-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.topbar h2,
.panel-heading h3 {
  margin: 0;
}

.topbar h2 {
  font-size: 28px;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--blue);
  color: #fff;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.icon-button {
  width: 40px;
  padding: 0;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  font-size: 20px;
}

.import-button input {
  display: none;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card,
.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.kpi-card span,
.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.kpi-card strong,
.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(440px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  min-width: 0;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-heading {
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h3 {
  font-size: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.warn {
  background: #fff7e6;
  color: var(--amber);
}

.pill.good {
  background: #e9fbf5;
  color: var(--green);
}

.trade-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

label,
fieldset {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

.table-date-input {
  max-width: 150px;
  padding: 7px 8px;
  font-size: 12px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.full-field,
.pair-box,
.form-actions {
  grid-column: 1 / -1;
}

.pair-box {
  grid-template-columns: 160px 1fr 1fr;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.pair-box legend {
  padding: 0 8px;
  color: var(--muted);
}

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

.check-line input {
  width: auto;
}

.form-actions {
  justify-content: flex-end;
  gap: 10px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 18px 0;
}

.chart-wrap {
  padding: 18px;
}

canvas {
  display: block;
  width: 100%;
  height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1320px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 13px;
}

.positive {
  color: var(--green);
  font-weight: 800;
}

.negative {
  color: var(--red);
  font-weight: 800;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr);
  gap: 16px;
  padding: 18px;
}

.review-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.review-editor label {
  align-content: start;
}

.review-audit {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 16px;
}

.review-audit h4 {
  margin: 0 0 12px;
  font-size: 15px;
}

.audit-list {
  display: grid;
  gap: 10px;
}

.audit-item {
  border-left: 3px solid var(--amber);
  background: #fff;
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.audit-item.good {
  border-left-color: var(--green);
}

.event-list,
.news-list,
.upcoming-list,
.watch-list {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.event-item,
.news-item,
.catalyst-item,
.watch-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.event-row {
  display: grid;
  grid-template-columns: 1fr 110px 150px;
  gap: 10px;
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.news-list {
  gap: 8px;
}

.news-list .news-item {
  gap: 8px;
  padding: 10px 12px;
}

.news-list .tags {
  display: none;
}

.symbol-badge,
.mini-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.symbol-badge {
  background: #e9f0ff;
  color: #1d4ed8;
}

.headline {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
  text-decoration: none;
}

.headline:hover {
  color: var(--blue);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-tag {
  background: #e9fbf5;
  color: var(--green);
}

.panel-footnote {
  padding: 0 18px 16px;
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #fff;
}

.watch-item {
  grid-template-columns: 1fr 100px 120px;
}

.watch-add-form {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 90px 110px;
  gap: 10px;
  padding: 18px 18px 0;
}

.watch-add-form textarea,
.watch-add-form button {
  grid-column: 1 / -1;
}

.watch-item textarea,
.watch-item button {
  grid-column: 1 / -1;
}

.text-button {
  width: max-content;
  border: 0;
  background: transparent;
  color: var(--red);
  padding: 0;
  font-weight: 800;
}

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

@media (max-width: 1180px) {
  .app-shell,
  .workspace-grid,
  .two-column {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .quote-status {
    position: static;
    margin-top: 20px;
  }

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

@media (max-width: 720px) {
  main {
    padding: 16px;
  }

  .topbar,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .trade-form,
  .pair-box,
  .analytics-grid,
  .kpi-grid,
  .review-grid,
  .review-editor,
  .event-row,
  .watch-add-form,
  .watch-item {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .topbar-actions {
    justify-content: stretch;
    width: 100%;
  }

  .primary-button,
  .secondary-button {
    flex: 1;
  }
}
