:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --border: #d1d5db;
}

* {
  box-sizing: border-box;
}

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

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

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-item {
  text-decoration: none;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
}

.menu-item:hover {
  background: var(--panel-2);
}

.menu-item.active {
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.28);
}

.content {
  padding: 24px;
}

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

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

.sub-menu-item {
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
}

.sub-menu-item.active {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.28);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}

.chart-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.chart-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 10px;
}

.chart-panel-title:first-child {
  margin-top: 0;
}

.chart-container {
  width: 100%;
  min-height: 200px;
  position: relative;
}

.chart-container-sub {
  min-height: 130px;
}

.desc {
  color: var(--muted);
  margin-top: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text);
  font-size: 14px;
}

.form-grid input,
.form-grid select,
.form-grid button {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
}

.form-actions {
  display: flex;
  align-items: end;
}

.form-grid button {
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  min-width: 120px;
}

.form-grid button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.result-box {
  margin: 0 0 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  min-height: 120px;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
}

.section-line {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.analysis-section {
  margin-bottom: 20px;
}

.analysis-section h3 {
  margin: 0 0 8px;
}

.tab-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
}

.tab-btn.active {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.28);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.placeholder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.placeholder-box {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.placeholder-box h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.placeholder-space {
  min-height: 120px;
  border: 1px dashed #c4cbd6;
  border-radius: 8px;
  background: #fff;
}

.placeholder-space.large {
  min-height: 220px;
}

.placeholder-space.medium {
  min-height: 160px;
}

.placeholder-space.xl {
  min-height: 560px;
}

.analysis-workspace {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  align-items: start;
}

.analysis-column {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.verify-column .placeholder-box + .placeholder-box {
  margin-top: 12px;
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.table-toolbar h4 {
  margin: 0;
}

.json-status-line {
  margin: 0 0 8px;
  font-size: 12px;
}

.status-segment {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 12px;
}

.seg-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}

.seg-btn.active {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.28);
}

.verify-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.strategy-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strategy-item {
  text-align: left;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
}

.strategy-item.active {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.28);
}

.detail-list p {
  margin: 0 0 8px;
  font-size: 14px;
}

.strategy-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.strategy-table th,
.strategy-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 14px;
  text-align: left;
  vertical-align: top;
}

.strategy-table th {
  background: #f8fafc;
  font-weight: 600;
}

.strategy-table tr:last-child td {
  border-bottom: none;
}

.link-btn {
  border: none;
  background: none;
  color: #1d4ed8;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  text-align: left;
}

.link-btn:hover {
  text-decoration: underline;
}

.strategy-detail-row td {
  background: #f8fafc;
}

.strategy-name-cell {
  min-width: 220px;
}

.strategy-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.ghost-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.ghost-btn:hover {
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--primary);
}

.report-panel .report-empty {
  margin-bottom: 0;
}

.report-table-wrap {
  margin-top: 10px;
  max-height: min(70vh, 560px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

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

.report-trade-table th,
.report-trade-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.report-trade-table thead th {
  background: #f8fafc;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.report-trade-table tbody tr:last-child th,
.report-trade-table tbody tr:last-child td {
  border-bottom: none;
}

.report-date-cell {
  font-weight: 600;
  white-space: nowrap;
  width: 1%;
}

.report-stack-cell .cell-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report-stack-cell .stack-line {
  margin: 0;
  line-height: 1.45;
}

.report-stack-cell .stack-label {
  color: var(--muted);
  font-size: 12px;
  margin-right: 4px;
}

@media (max-width: 1100px) {
  .analysis-workspace {
    grid-template-columns: 1fr;
  }

  .verify-layout {
    grid-template-columns: 1fr;
  }
}
