:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --ok: #027a48;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}
.brand { color: var(--text); font-weight: 750; font-size: 18px; }
nav { display: flex; gap: 18px; }
.shell { max-width: 1280px; margin: 0 auto; padding: 28px; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 22px;
}
h1, h2 { margin: 0 0 8px; letter-spacing: 0; }
h1 { font-size: 30px; }
h2 { font-size: 20px; margin-top: 18px; }
p { color: var(--muted); margin: 0; }
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 18px 0 26px;
}
.metrics div, .login-panel, .grid-two > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.metrics span, small { color: var(--muted); display: block; font-size: 12px; }
.metrics strong { display: block; font-size: 23px; margin-top: 5px; }
.grid-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dashboard-stack { display: grid; gap: 18px; }
.dashboard-stack > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  min-width: 0;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}
.section-title h2 { margin: 0; }
.asset-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.asset-filter label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}
.asset-filter input {
  width: auto;
  margin: 0;
}
.asset-filter button { padding: 8px 10px; }
.open-positions { font-size: 14px; }
.stop-loss-form {
  display: grid;
  grid-template-columns: 86px auto;
  gap: 6px;
  align-items: center;
}
.stop-loss-form input {
  min-width: 0;
  padding: 7px 8px;
}
.stop-loss-form button {
  padding: 7px 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; background: #f9fafb; }
tr:last-child td { border-bottom: 0; }
.wide { font-size: 14px; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }
.pill {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}
button, .button {
  appearance: none;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
}
button:hover, .button:hover { background: var(--accent-dark); text-decoration: none; }
.secondary {
  background: #eef2f6;
  color: var(--text);
}
.secondary:hover { background: #dfe5ee; }
.small-button {
  padding: 7px 9px;
  font-size: 13px;
  white-space: nowrap;
}
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  background: #ffffff;
}
textarea { resize: vertical; }
.stack { display: grid; gap: 14px; }
.filters { display: grid; grid-template-columns: minmax(220px, 1fr) 150px auto; gap: 10px; align-items: center; }
.login-panel { max-width: 420px; margin: 80px auto; }
.form-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.trade-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}
.form-actions {
  grid-column: 1 / -1;
}
.upload {
  display: flex;
  gap: 12px;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 22px;
}
.notice { background: #ecfdf3; color: #05603a; border: 1px solid #abefc6; padding: 12px; border-radius: 8px; margin-bottom: 16px; }
.error { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; padding: 12px; border-radius: 8px; margin-bottom: 16px; }
@media (max-width: 800px) {
  .topbar, .page-head, .upload { align-items: stretch; flex-direction: column; height: auto; padding: 16px; }
  nav { flex-wrap: wrap; }
  .shell { padding: 16px; }
  .grid-two, .filters { grid-template-columns: 1fr; }
  .trade-form { grid-template-columns: 1fr; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .stop-loss-form { grid-template-columns: 80px auto; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
}
