:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #657184;
  --line: #dce2ea;
  --soft: #f6f8fb;
  --accent: #1769aa;
  --accent-2: #0f8b6f;
  --danger: #c0393f;
  --warn: #b07a12;
  --shadow: 0 18px 40px rgba(31, 43, 61, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  overflow-y: auto;
  color: #f8fbff;
  background: #172333;
}

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

.mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #214563;
  color: #f4ce70;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.panel p {
  margin: 0;
}

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

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

.toolbar {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  margin-bottom: 14px;
}

input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus {
  border-color: #69a6d7;
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.14);
}

.toolbar input {
  border-color: rgba(255, 255, 255, 0.14);
  color: #f8fbff;
  background: rgba(255, 255, 255, 0.07);
}

.toolbar input::placeholder {
  color: #95a3b3;
}

.icon-button,
.primary-button,
.ghost-button,
.danger-button,
.small-button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.icon-button {
  min-width: 42px;
  min-height: 38px;
  color: #fff;
  background: var(--accent);
  font-size: 22px;
}

.primary-button {
  min-height: 38px;
  padding: 8px 14px;
  color: #fff;
  background: var(--accent);
}

.ghost-button {
  min-height: 36px;
  padding: 7px 12px;
  color: var(--ink);
  background: #e8edf3;
}

.danger-button {
  min-height: 30px;
  padding: 5px 9px;
  color: #fff;
  background: var(--danger);
}

.small-button {
  min-height: 30px;
  padding: 5px 9px;
  color: var(--accent);
  background: #eaf3fb;
}

button:hover {
  transform: translateY(-1px);
}

.fund-list {
  display: grid;
  gap: 8px;
}

.fund-item {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  color: #f8fbff;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  text-align: left;
}

.fund-item.active {
  border-color: #f4ce70;
  background: rgba(244, 206, 112, 0.14);
}

.fund-name {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
}

.fund-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: #b9c5d2;
  font-size: 12px;
}

.main {
  padding: 26px;
}

.topbar,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 18px;
}

.topbar h2 {
  font-size: 26px;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.kpi {
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: var(--panel);
  box-shadow: 0 8px 18px rgba(31, 43, 61, 0.05);
}

.kpi span {
  color: var(--muted);
  font-size: 12px;
}

.kpi strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
}

.kpi small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(560px, 1.25fr) minmax(380px, 0.75fr);
  gap: 16px;
  margin-bottom: 16px;
}

.entry-grid,
.tables {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

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

.panel h3 {
  font-size: 17px;
}

.chart-panel {
  min-height: 430px;
}

canvas {
  width: 100%;
  height: 340px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.badge {
  min-width: 126px;
  border-radius: 999px;
  padding: 7px 10px;
  color: #0d5f4f;
  background: #e5f6f1;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.badge.sell {
  color: #7d2d32;
  background: #fae7e8;
}

.badge.hold {
  color: #76530a;
  background: #fbf0d4;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.form-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

.table-wrap {
  max-height: 420px;
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  white-space: nowrap;
  text-align: right;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: var(--soft);
  font-size: 12px;
}

tr:hover td {
  background: #f8fbff;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.positive {
  color: var(--danger);
}

.negative {
  color: var(--accent-2);
}

.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  border-radius: 8px;
  padding: 12px 14px;
  color: #fff;
  background: #172333;
  box-shadow: var(--shadow);
}

@media (max-width: 1260px) {
  body {
    min-width: 1024px;
  }

  .shell {
    grid-template-columns: 290px 1fr;
  }

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

  .workspace,
  .entry-grid,
  .tables {
    grid-template-columns: 1fr;
  }
}
