:root {
  color-scheme: dark;
  --bg: #07090b;
  --surface: #0d1114;
  --surface-2: #10161a;
  --ink: #f2efe7;
  --soft: #d3d0c8;
  --muted: #8e969b;
  --faint: #5f686d;
  --line: rgba(242, 239, 231, 0.1);
  --line-strong: rgba(242, 239, 231, 0.18);
  --green: #35d07f;
  --green-soft: #9df2bf;
  --amber: #ffb04a;
  --red: #ff6f61;
  --blue: #8aa8ff;
  --display: "Space Grotesk", "Pretendard Variable", Pretendard, "Segoe UI", sans-serif;
  --sans: "Pretendard Variable", Pretendard, "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
  background:
    linear-gradient(90deg, rgba(242, 239, 231, 0.028) 1px, transparent 1px),
    linear-gradient(rgba(242, 239, 231, 0.028) 1px, transparent 1px),
    linear-gradient(135deg, rgba(53, 208, 127, 0.12), transparent 460px),
    linear-gradient(230deg, rgba(138, 168, 255, 0.075), transparent 520px),
    #07090b;
  background-size: 64px 64px, 64px 64px, auto, auto, auto;
}

a {
  color: inherit;
  text-decoration: none;
}

.terminal-shell {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 18px;
  width: min(1500px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0;
}

.side-rail {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  background: rgba(13, 17, 20, 0.72);
}

.side-rail span,
.mark,
.kicker,
.session-state span,
.metric span,
.metric em,
.panel-head span,
.range-tabs,
.table-head,
.table-note,
.row b,
.log-stream time,
.log-stream span,
.rationale-list span {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.side-rail span,
.mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  color: var(--faint);
}

.mark {
  color: var(--green-soft);
  font-weight: 700;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 14px;
}

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

.kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--green);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: var(--display);
  font-size: 34px;
  font-weight: 650;
  line-height: 1;
}

.session-state {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.session-state span {
  color: var(--faint);
}

.session-state strong {
  color: var(--amber);
  font-family: var(--display);
  font-size: 18px;
}

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

.metric,
.panel {
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(180deg, rgba(242, 239, 231, 0.035), transparent 52%),
    rgba(13, 17, 20, 0.82);
  box-shadow: 0 20px 58px rgba(0, 0, 0, 0.26);
}

.metric {
  min-height: 92px;
  padding: 12px 14px;
}

.metric span,
.metric em,
.panel-head span,
.table-note,
.table-head,
.log-stream time,
.rationale-list span {
  color: var(--faint);
}

.metric strong {
  display: block;
  margin: 14px 0 7px;
  color: var(--soft);
  font-family: var(--display);
  font-size: 28px;
  line-height: 1;
}

.metric:first-child strong {
  color: var(--green-soft);
}

.metric.danger strong {
  color: var(--red);
}

.metric em {
  font-style: normal;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  grid-template-areas:
    "chart macro"
    "positions calendar"
    "log insider";
  gap: 12px;
}

.chart-panel {
  grid-area: chart;
}

.macro-panel {
  grid-area: macro;
}

.positions-panel {
  grid-area: positions;
}

.calendar-panel {
  grid-area: calendar;
}

.log-panel {
  grid-area: log;
  display: grid;
  grid-template-rows: auto 1fr;
}

.insider-panel {
  grid-area: insider;
}

.panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

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

h2 {
  margin-bottom: 0;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 620;
  line-height: 1;
}

.range-tabs {
  display: flex;
  gap: 6px;
  color: var(--faint);
}

.range-tabs span,
.range-tabs strong {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 24px;
  border: 1px solid var(--line);
  font-weight: 600;
}

.range-tabs strong {
  color: var(--green-soft);
  background: rgba(53, 208, 127, 0.08);
}

.chart-stage {
  min-height: 256px;
  padding: 14px 18px 10px;
  background:
    linear-gradient(rgba(242, 239, 231, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 239, 231, 0.055) 1px, transparent 1px);
  background-size: 48px 48px;
}

.chart-stage svg {
  display: block;
  width: 100%;
  height: 220px;
}

.area {
  fill: url("#signalFill");
}

.line {
  fill: none;
  stroke: var(--green);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  filter: drop-shadow(0 0 10px rgba(53, 208, 127, 0.18));
}

.health-list {
  display: grid;
  padding: 12px 16px 16px;
}

.health-list p {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  color: var(--soft);
  font-size: 14px;
}

.health-list p:last-child {
  border-bottom: 0;
}

.health-list p span {
  width: 7px;
  height: 7px;
  background: var(--green);
  box-shadow: 0 0 16px rgba(53, 208, 127, 0.4);
}

.health-list strong {
  color: var(--green-soft);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.positions-table {
  display: grid;
}

.table-head,
.row {
  display: grid;
  grid-template-columns: 140px 70px minmax(0, 1fr) 130px 100px 90px;
  gap: 14px;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.table-head {
  min-height: 34px;
}

.row:last-child {
  border-bottom: 0;
}

.row strong {
  color: var(--green);
  font-family: var(--mono);
  font-size: 14px;
}

.row span,
.row em {
  color: var(--soft);
  font-size: 14px;
  font-style: normal;
  overflow-wrap: anywhere;
}

.row em {
  color: var(--muted);
}

.row b {
  justify-self: end;
  color: var(--green-soft);
}

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

.warning,
.row.blocked strong,
.row.blocked b {
  color: var(--amber) !important;
}

.rationale-list {
  display: grid;
}

.rationale-list article {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.rationale-list article:last-child {
  border-bottom: 0;
}

.rationale-list p {
  margin-bottom: 0;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.55;
  word-break: keep-all;
}

.log-stream {
  display: grid;
  align-content: start;
  min-height: 100%;
  padding: 10px 14px;
  background:
    linear-gradient(rgba(53, 208, 127, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53, 208, 127, 0.075) 1px, transparent 1px),
    rgba(7, 9, 11, 0.5);
  background-size: 18px 18px;
}

.log-stream p {
  display: grid;
  grid-template-columns: 72px 52px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 0;
  padding: 11px 0;
  border-bottom: 1px solid rgba(242, 239, 231, 0.075);
  color: var(--soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
}

.log-stream span {
  color: var(--muted);
  font-weight: 700;
}

.log-stream .ok {
  color: var(--green);
}

.log-stream .warn {
  color: var(--amber);
}

@media (max-width: 1120px) {
  .terminal-shell {
    grid-template-columns: 1fr;
  }

  .side-rail {
    display: none;
  }

  .main-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "chart"
      "macro"
      "positions"
      "calendar"
      "log"
      "insider";
  }
}

@media (max-width: 760px) {
  .terminal-shell {
    width: min(100% - 22px, 1500px);
  }

  .topbar,
  .metrics {
    grid-template-columns: 1fr;
  }

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

  .session-state {
    justify-items: start;
  }

  .metrics {
    display: grid;
  }

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

  .table-head {
    display: none;
  }

  .row {
    grid-template-columns: 1fr;
    gap: 6px;
    min-height: auto;
    padding: 14px 16px;
  }

  .row b {
    justify-self: start;
  }

  .log-stream p {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* --- Added Widget Styling (Insider & Macro Edition) --- */

/* Badges */
.badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
  display: inline-block;
  letter-spacing: 0.5px;
}

.badge-neutral {
  background: rgba(142, 150, 155, 0.12);
  border: 1px solid rgba(142, 150, 155, 0.3);
  color: var(--muted);
}

.badge-ok {
  background: rgba(53, 208, 127, 0.12);
  border: 1px solid rgba(53, 208, 127, 0.3);
  color: var(--green-soft);
}

.badge-info {
  background: rgba(138, 168, 255, 0.12);
  border: 1px solid rgba(138, 168, 255, 0.3);
  color: var(--blue);
}

.badge-buy {
  background: rgba(53, 208, 127, 0.15);
  border: 1px solid var(--green);
  color: var(--green-soft);
}

.badge-sell {
  background: rgba(255, 111, 97, 0.15);
  border: 1px solid var(--red);
  color: #ff9e96;
}

.badge-whale {
  background: rgba(255, 176, 74, 0.15);
  border: 1px solid var(--amber);
  color: #ffd091;
}

.badge-event {
  background: rgba(138, 168, 255, 0.15);
  border: 1px solid var(--blue);
  color: var(--blue);
}

.badge-earnings {
  background: rgba(242, 239, 231, 0.08);
  border: 1px solid var(--line-strong);
  color: var(--soft);
}

/* Macro List */
.macro-list {
  display: grid;
  padding: 12px 16px 16px;
}

.macro-list p {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 82px;
  gap: 12px;
  align-items: center;
  min-height: 38px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  color: var(--soft);
  font-size: 14px;
}

.macro-list p:last-child {
  border-bottom: 0;
}

.macro-list strong {
  font-family: var(--mono);
  color: var(--ink);
  font-size: 15px;
  justify-self: end;
}

.macro-list .badge {
  justify-self: end;
  text-align: center;
  min-width: 72px;
}

/* Calendar List */
.calendar-list {
  display: grid;
  align-content: start;
}

.calendar-list article {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.calendar-list article:last-child {
  border-bottom: 0;
}

.cal-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.cal-meta time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.cal-content strong {
  display: block;
  font-size: 13.5px;
  color: var(--ink);
  margin-bottom: 4px;
}

.cal-content p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

/* Insider & Whale List */
.insider-list {
  display: grid;
  align-content: start;
}

.insider-list article {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.insider-list article:last-child {
  border-bottom: 0;
}

.insider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.insider-header strong {
  font-family: var(--display);
  font-size: 15px;
  color: var(--ink);
}

.insider-header time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  margin-left: auto;
}

.insider-body p {
  margin: 0 0 6px 0;
  font-size: 13px;
  color: var(--soft);
  line-height: 1.4;
}

.insider-details {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
}

.insider-details strong {
  color: var(--soft);
  font-family: var(--mono);
}

