:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-soft: #f3f5f8;
  --text: #191f28;
  --muted: #6b7684;
  --line: #e5e8eb;
  --blue: #3182f6;
  --blue-soft: #e8f3ff;
  --green: #00a661;
  --green-soft: #e9f8f1;
  --red: #f04452;
  --red-soft: #fff0f2;
  --amber: #f59f00;
  --amber-soft: #fff7df;
  --shadow: 0 10px 30px rgba(25, 31, 40, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, "Segoe UI", "Noto Sans KR", Arial, sans-serif;
}

button,
table {
  font: inherit;
}

.app-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 32px;
}

.topbar {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.title-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

.strategy-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.clock-block {
  min-width: 150px;
  min-height: 56px;
  display: grid;
  align-content: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 9px 12px;
}

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

.clock-block strong {
  font-size: 18px;
  letter-spacing: 0;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 14px;
}

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

.metric {
  min-height: 112px;
  display: grid;
  align-content: space-between;
  padding: 15px;
}

.metric span,
.metric small,
.panel-head p,
.runtime-item span,
.position-stats span,
.liq-line span,
.position-title small {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  margin-top: 6px;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  margin-bottom: 14px;
}

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

.bottom-grid {
  align-items: start;
}

.panel {
  min-width: 0;
}

.panel-head {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 16px 10px;
}

.panel-head.compact {
  min-height: 58px;
}

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

.position-card {
  min-height: 244px;
  padding: 14px;
  box-shadow: none;
}

.position-title {
  min-height: 38px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.symbol {
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0;
}

.position-title small {
  display: block;
  margin-top: 2px;
}

.position-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.position-stats div,
.liq-line,
.runtime-item {
  min-height: 52px;
  display: grid;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 9px;
}

.position-stats strong,
.liq-line strong,
.runtime-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.2;
}

.liq-line {
  margin-top: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.runtime-list {
  display: grid;
  gap: 8px;
  padding: 0 16px 16px;
}

.runtime-item {
  min-height: 48px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.status-pill {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.dark {
  background: var(--text);
  color: #fff;
}

.status-pill.info,
.info {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-pill.success,
.success {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.warning,
.warning,
.status-pill.live,
.live {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.danger,
.danger {
  background: var(--red-soft);
  color: var(--red);
}

.status-pill.muted,
.muted {
  color: var(--muted);
}

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

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

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.compact-table {
  max-height: 380px;
}

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

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

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

th:nth-child(2),
td:nth-child(2),
.reason-cell {
  text-align: left;
}

.reason-cell {
  max-width: 260px;
  min-width: 180px;
  white-space: normal;
  color: var(--muted);
}

.empty-cell,
.empty-panel {
  color: var(--muted);
  text-align: center;
}

.empty-panel {
  min-height: 120px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 20px;
}

.list-grid,
.job-list {
  display: grid;
  gap: 8px;
  padding: 0 16px 16px;
}

.list-item,
.job-item {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px 12px;
}

.list-item,
.job-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.list-item strong,
.job-top strong {
  font-size: 14px;
}

.list-item span,
.job-item p {
  color: var(--muted);
  font-size: 12px;
}

.list-item span {
  display: block;
  margin-top: 2px;
}

.job-item p {
  margin-top: 8px;
  line-height: 1.45;
  word-break: break-word;
}

@media (max-width: 1100px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 700px) {
  .app-shell {
    width: min(100vw - 20px, 1280px);
    padding-top: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding-bottom: 14px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .clock-block {
    min-width: 0;
    width: 100%;
  }

  h1 {
    font-size: 23px;
  }

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

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .position-stats {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 680px;
  }
}
