:root {
  --bg: #080d12;
  --bg-soft: #0d151d;
  --panel: rgba(16, 25, 33, 0.86);
  --panel-strong: rgba(20, 32, 42, 0.96);
  --line: rgba(139, 168, 183, 0.18);
  --text: #e6eef2;
  --muted: #8fa3ad;
  --dim: #5f747f;
  --green: #49d79f;
  --cyan: #4fc3d7;
  --amber: #e4b45b;
  --red: #d76c73;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 1120px;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 70% -10%, rgba(73, 215, 159, 0.18), transparent 34%),
    radial-gradient(circle at 18% 18%, rgba(79, 195, 215, 0.13), transparent 28%),
    linear-gradient(145deg, #070b0f, #10161c 50%, #071015);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

textarea,
input {
  width: 100%;
  color: var(--text);
  background: rgba(4, 9, 13, 0.58);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 104px;
  padding: 12px;
  resize: vertical;
}

textarea:focus,
input:focus {
  border-color: rgba(73, 215, 159, 0.6);
  box-shadow: 0 0 0 3px rgba(73, 215, 159, 0.08);
  background: rgba(5, 12, 17, 0.76);
}

#particleCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.72;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 248px 1fr;
  height: 100vh;
  padding: 18px;
  gap: 18px;
}

.sidebar,
.workspace,
.panel {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px;
  border-radius: 18px;
  background: rgba(9, 16, 22, 0.82);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #06100c;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  border-radius: 12px;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.eyebrow,
.hint,
label,
.sidebar-card small {
  color: var(--muted);
}

.sheet-nav {
  display: grid;
  gap: 8px;
  margin-top: 26px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
}

.nav-item span {
  color: var(--dim);
  font-size: 12px;
}

.nav-item.active,
.nav-item:hover {
  color: var(--text);
  background: rgba(73, 215, 159, 0.08);
  border-color: rgba(73, 215, 159, 0.22);
}

.sidebar-card {
  margin-top: auto;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.mini-pixels {
  display: flex;
  gap: 5px;
  margin-top: 12px;
}

.mini-pixels i {
  width: 9px;
  height: 9px;
  background: var(--amber);
  box-shadow: 14px 0 rgba(73, 215, 159, 0.8);
}

.workspace {
  min-width: 0;
  min-height: 0;
  padding: 20px;
  overflow: hidden;
  border-radius: 22px;
  background: rgba(7, 12, 17, 0.68);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  font-size: 12px;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.top-actions,
.panel-head,
.inline-actions,
.form-row,
.segment,
.review-meter,
.side-metric {
  display: flex;
  align-items: center;
}

.top-actions {
  gap: 10px;
}

.inline-actions {
  gap: 8px;
}

.primary-button,
.ghost-button,
.text-button,
.icon-button {
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.primary-button {
  height: 40px;
  padding: 0 16px;
  color: #06100c;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  border: 0;
  font-weight: 800;
}

.ghost-button {
  height: 40px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.04);
}

.ghost-button.small {
  height: 32px;
  padding: 0 10px;
}

.filter-input {
  position: relative;
  z-index: 1;
  height: 38px;
  margin-bottom: 12px;
}

.filter-segment {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.filter-segment button {
  min-height: 30px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 12px;
}

.filter-segment button.active {
  color: #06100c;
  background: var(--amber);
  font-weight: 800;
}

.text-button {
  height: 32px;
  padding: 0 10px;
  color: var(--green);
  background: rgba(73, 215, 159, 0.08);
}

.danger-button {
  height: 30px;
  padding: 0 9px;
  color: var(--red);
  background: rgba(215, 108, 115, 0.08);
  border: 1px solid rgba(215, 108, 115, 0.2);
  border-radius: 8px;
}

.icon-button {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.05);
}

.sync-pill,
.save-pill,
.status-badge,
.market-state {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  color: var(--green);
  background: rgba(73, 215, 159, 0.08);
  border: 1px solid rgba(73, 215, 159, 0.24);
  border-radius: 999px;
  font-size: 12px;
}

.save-pill {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

.save-pill[data-tone="saving"] {
  color: var(--cyan);
  border-color: rgba(79, 195, 215, 0.24);
}

.save-pill[data-tone="saved"] {
  color: var(--green);
  border-color: rgba(73, 215, 159, 0.24);
}

.save-pill[data-tone="dirty"] {
  color: var(--amber);
  background: rgba(228, 180, 91, 0.08);
  border-color: rgba(228, 180, 91, 0.3);
}

.save-pill[data-tone="backup"] {
  color: var(--cyan);
  background: rgba(79, 195, 215, 0.07);
  border-color: rgba(79, 195, 215, 0.24);
}

.save-pill[data-tone="warning"] {
  color: var(--amber);
  border-color: rgba(228, 180, 91, 0.3);
}

.save-pill[data-tone="error"] {
  color: var(--red);
  border-color: rgba(215, 108, 115, 0.3);
}

.sheet {
  display: none;
  height: calc(100vh - 128px);
  overflow: auto;
  padding: 2px 4px 12px 2px;
  animation: sheetIn 260ms ease both;
}

.sheet.active {
  display: block;
}

@keyframes sheetIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-grid,
.market-layout,
.split-layout,
.decision-layout,
.plan-layout,
.journal-grid {
  display: grid;
  gap: 16px;
}

.overview-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.65fr);
}

.panel {
  position: relative;
  min-width: 0;
  padding: 18px;
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 36%);
  pointer-events: none;
}

.hero-panel {
  grid-column: 1 / 2;
}

.calendar-panel {
  grid-column: 1 / 2;
}

.side-panel {
  grid-row: 1 / 4;
  grid-column: 2 / 3;
}

.panel-head {
  position: relative;
  z-index: 1;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head.compact {
  margin-bottom: 10px;
}

.review-meter {
  position: relative;
  z-index: 1;
  gap: 18px;
}

.review-meter strong {
  display: block;
  font-size: 34px;
}

.review-meter span {
  color: var(--muted);
}

.progress-track {
  flex: 1;
  height: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--cyan), var(--amber));
  border-radius: inherit;
  transition: width 600ms ease;
}

.research-score {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 110px 1fr 52px;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.research-score strong {
  color: var(--text);
}

.upward-chart {
  display: flex;
  align-items: end;
  gap: 8px;
  height: 88px;
  margin-top: 18px;
}

.upward-chart span {
  flex: 1;
  min-width: 0;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, rgba(73, 215, 159, 0.62), rgba(73, 215, 159, 0.08));
}

.upward-chart span:nth-child(1) { height: 26%; }
.upward-chart span:nth-child(2) { height: 34%; }
.upward-chart span:nth-child(3) { height: 48%; }
.upward-chart span:nth-child(4) { height: 66%; }
.upward-chart span:nth-child(5) { height: 86%; }

.card-list,
.watch-list,
.review-list,
.stage-list,
.company-list,
.decision-list,
.task-list,
.today-actions,
.weekly-history,
#customQuestions {
  display: grid;
  gap: 10px;
}

.week-calendar {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-day {
  display: grid;
  gap: 8px;
  min-width: 0;
  min-height: 116px;
  padding: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.calendar-day.today {
  border-color: rgba(228, 180, 91, 0.5);
  background: rgba(228, 180, 91, 0.07);
}

.calendar-day strong {
  font-size: 22px;
}

.calendar-name {
  color: var(--muted);
  font-size: 12px;
}

.calendar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.calendar-tags i {
  min-height: 22px;
  padding: 3px 6px;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
}

.calendar-tags i.done {
  color: #06100c;
  background: var(--green);
  border-color: transparent;
}

.prompt-bank {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-chip {
  max-width: 100%;
  min-height: 32px;
  padding: 7px 10px;
  color: var(--cyan);
  background: rgba(79, 195, 215, 0.075);
  border: 1px solid rgba(79, 195, 215, 0.18);
  border-radius: 8px;
  font-size: 12px;
  text-align: left;
}

.prompt-chip:hover {
  color: #06100c;
  background: var(--cyan);
}

.mini-card,
.watch-row,
.review-row,
.stage-row,
.today-row,
.company-item,
.decision-card,
.history-card,
.task-row,
.source-item {
  position: relative;
  z-index: 1;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.mini-card strong,
.watch-row strong,
.review-row strong,
.company-item strong {
  display: block;
  margin-bottom: 6px;
}

.mini-progress {
  height: 6px;
  margin-top: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.mini-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  border-radius: inherit;
}

.stage-row,
.today-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stage-bar {
  flex: 1;
  height: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.stage-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  border-radius: inherit;
}

.today-row button {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  color: transparent;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.today-row button.done {
  color: #07110d;
  background: var(--green);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.24);
}

.meta,
.mini-card p,
.watch-row p,
.decision-card p,
.reward-panel p {
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.55;
}

.decision-card.active-record {
  border-color: rgba(228, 180, 91, 0.48);
  background: rgba(228, 180, 91, 0.07);
}

.history-card summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
}

.history-card pre {
  max-height: 240px;
  margin: 12px 0 0;
  overflow: auto;
  color: var(--muted);
  white-space: pre-wrap;
  font-family: inherit;
  line-height: 1.55;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  margin-right: 6px;
  color: var(--cyan);
  background: rgba(79, 195, 215, 0.08);
  border-radius: 999px;
  font-size: 12px;
}

.tag.risk {
  color: var(--red);
  background: rgba(215, 108, 115, 0.1);
}

.side-panel textarea {
  min-height: 190px;
}

.today-box {
  position: relative;
  z-index: 1;
  margin-top: 16px;
}

.side-metric {
  justify-content: space-between;
  margin-top: 16px;
  padding: 14px;
  background: rgba(73, 215, 159, 0.06);
  border: 1px solid rgba(73, 215, 159, 0.18);
  border-radius: 10px;
}

.pixel-badge {
  display: grid;
  width: 70px;
  height: 70px;
  place-items: center;
  margin-top: 16px;
  color: #07110d;
  background: var(--amber);
  border-radius: 8px;
  font-size: 32px;
  font-weight: 900;
  image-rendering: pixelated;
  box-shadow:
    6px 6px 0 rgba(0, 0, 0, 0.4),
    inset -5px -5px 0 rgba(0, 0, 0, 0.16);
}

.market-layout {
  grid-template-columns: 1.1fr 0.8fr;
}

.wide,
.market-hero {
  grid-column: 1 / -1;
}

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

.index-card,
.sector-card {
  position: relative;
  z-index: 1;
  padding: 14px;
  min-height: 102px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.index-card strong {
  display: block;
  margin: 8px 0;
  font-size: 24px;
}

.index-card input,
.sector-card input {
  height: 34px;
  margin-top: 8px;
  font-weight: 700;
}

.index-card input:first-of-type,
.sector-card input:first-of-type {
  margin-top: 10px;
}

.market-pulse-panel {
  background:
    radial-gradient(circle at 12% 26%, rgba(228, 180, 91, 0.14), transparent 34%),
    var(--panel);
}

.pulse-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 132px repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
}

.pulse-orb {
  display: grid;
  width: 118px;
  height: 118px;
  place-items: center;
  background:
    radial-gradient(circle, rgba(73, 215, 159, 0.24), rgba(79, 195, 215, 0.06) 58%, transparent 62%),
    conic-gradient(from 215deg, rgba(73, 215, 159, 0.8), rgba(228, 180, 91, 0.86), rgba(215, 108, 115, 0.55), rgba(73, 215, 159, 0.8));
  border: 1px solid rgba(73, 215, 159, 0.2);
  border-radius: 50%;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.52);
}

.pulse-orb span {
  font-size: 34px;
  font-weight: 900;
}

.pulse-orb small {
  margin-top: -28px;
  color: var(--muted);
}

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

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

.flat {
  color: var(--amber);
}

.table-wrap {
  position: relative;
  z-index: 1;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

td input {
  height: 34px;
  min-width: 120px;
}

.split-layout {
  grid-template-columns: 280px 1fr;
}

.list-panel,
.editor-panel {
  height: calc(100vh - 142px);
  overflow: auto;
}

.company-item {
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.company-item.active {
  border-color: rgba(73, 215, 159, 0.48);
  background: rgba(73, 215, 159, 0.08);
}

.form-row {
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 7px;
  flex: 1;
  font-size: 13px;
}

.accordion-list {
  display: grid;
  gap: 10px;
}

.accordion {
  position: relative;
  z-index: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.035);
}

.accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  cursor: pointer;
  list-style: none;
}

.accordion summary::-webkit-details-marker {
  display: none;
}

.accordion summary::after {
  content: "⌄";
  color: var(--green);
  transition: transform 180ms ease;
}

.accordion[open] summary::after {
  transform: rotate(180deg);
}

.accordion textarea {
  min-height: 128px;
  border-width: 1px 0 0;
  border-radius: 0;
}

.source-box {
  position: relative;
  z-index: 1;
  margin-top: 16px;
}

.decision-layout,
.plan-layout {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.segment {
  position: relative;
  z-index: 1;
  gap: 8px;
  padding: 6px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.segment button {
  flex: 1;
  height: 38px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.segment button.active {
  color: #06100c;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  font-weight: 800;
}

.decision-checklist {
  position: relative;
  z-index: 1;
  margin-bottom: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.decision-checklist.compact-box {
  padding: 12px;
}

.decision-radar {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px;
  background:
    radial-gradient(circle at 10% 20%, rgba(228, 180, 91, 0.12), transparent 34%),
    rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.radar-score {
  display: grid;
  place-items: center;
  min-height: 132px;
  color: var(--muted);
  background:
    radial-gradient(circle, rgba(73, 215, 159, 0.2), rgba(79, 195, 215, 0.06) 58%, transparent 62%),
    conic-gradient(from 210deg, rgba(73, 215, 159, 0.86), rgba(228, 180, 91, 0.7), rgba(215, 108, 115, 0.5), rgba(73, 215, 159, 0.86));
  border: 1px solid rgba(73, 215, 159, 0.2);
  border-radius: 12px;
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.5);
}

.radar-score strong {
  display: block;
  color: var(--text);
  font-size: 38px;
  line-height: 1;
}

.radar-score span {
  margin-top: -26px;
  font-size: 12px;
}

.radar-main {
  min-width: 0;
}

.quality-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.quality-bar {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.quality-bar span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quality-bar i {
  height: 8px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
}

.quality-bar.done {
  color: var(--green);
}

.quality-bar.done i {
  background: linear-gradient(90deg, var(--green), var(--cyan));
}

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

.gap-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 48px;
  padding: 9px 10px;
  color: var(--text);
  background: rgba(228, 180, 91, 0.065);
  border: 1px solid rgba(228, 180, 91, 0.18);
  border-radius: 8px;
  text-align: left;
}

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

.gap-item.complete {
  background: rgba(73, 215, 159, 0.07);
  border-color: rgba(73, 215, 159, 0.18);
}

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

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 9px 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.checklist-item input {
  width: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--green);
}

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

.decision-fields label:first-child,
.decision-fields label:last-child {
  grid-column: 1 / -1;
}

.decision-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.table-actions {
  display: flex;
  gap: 8px;
}

.table-actions .text-button,
.table-actions .danger-button {
  white-space: nowrap;
}

.task-row {
  display: grid;
  grid-template-columns: 1fr 150px 90px 58px;
  gap: 10px;
  align-items: center;
}

.checkin-table {
  position: relative;
  z-index: 1;
  overflow: auto;
}

.checkin-grid {
  display: grid;
  grid-template-columns: 230px repeat(7, 1fr) 86px;
  min-width: 820px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.checkin-cell {
  min-height: 52px;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.checkin-cell:nth-child(9n) {
  border-right: 0;
}

.checkin-head {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
}

.check-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  margin: 0 auto;
  color: transparent;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.check-button.done {
  color: #07110d;
  background: var(--green);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.26);
  animation: pixelPop 260ms steps(2, jump-none);
}

@keyframes pixelPop {
  0% { transform: scale(0.82); }
  70% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.journal-grid {
  grid-template-columns: 1fr 320px;
  margin-top: 16px;
}

.daily-review-panel {
  grid-column: 1 / 2;
}

.daily-review-fields {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.daily-review-fields textarea {
  min-height: 92px;
}

.daily-review-panel .source-box textarea {
  min-height: 150px;
}

.journal-tabs {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.journal-prompt-bank {
  margin-bottom: 12px;
}

.journal-tab {
  height: 34px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.journal-tab.active {
  color: #06100c;
  background: var(--amber);
  border-color: transparent;
  font-weight: 800;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.28);
}

.reward-stage {
  display: flex;
  align-items: end;
  gap: 12px;
  min-height: 120px;
}

.reward-stage span {
  display: block;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.reward-stage span.lit {
  background: var(--amber);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.34);
}

.toast {
  position: fixed;
  top: 28px;
  right: 28px;
  z-index: 10;
  padding: 12px 16px;
  color: #07110d;
  background: var(--amber);
  border-radius: 8px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast[data-tone="error"] {
  color: var(--text);
  background: var(--red);
}

.toast[data-tone="warning"] {
  background: var(--amber);
}

@media (max-width: 900px) {
  body {
    min-width: 0;
    overflow: auto;
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
    height: auto;
    padding: 12px;
  }

  .sidebar {
    position: sticky;
    top: 12px;
    z-index: 4;
    margin-bottom: 12px;
  }

  .sheet-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    overflow: visible;
    padding: 14px;
  }

  .topbar,
  .form-row {
    align-items: stretch;
    flex-direction: column;
    height: auto;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .top-actions button,
  .top-actions .sync-pill,
  .top-actions .save-pill {
    min-width: 0;
  }

  .sheet,
  .list-panel,
  .editor-panel {
    height: auto;
  }

  .overview-grid,
  .market-layout,
  .split-layout,
  .decision-layout,
  .plan-layout,
  .journal-grid {
    grid-template-columns: 1fr;
  }

  .side-panel,
  .hero-panel,
  .wide,
  .market-hero {
    grid-column: auto;
    grid-row: auto;
  }

  .index-grid,
  .sector-grid,
  .week-calendar,
  .decision-fields,
  .pulse-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .decision-radar,
  .pulse-grid {
    grid-template-columns: 1fr;
  }

  .pulse-orb,
  .radar-score {
    margin: 0 auto;
  }

  .task-row {
    grid-template-columns: 1fr 1fr;
  }

  .checklist-grid,
  .daily-review-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  html,
  body {
    width: 100%;
  }

  .app-shell {
    padding: 8px;
  }

  .sidebar,
  .workspace,
  .panel {
    border-radius: 12px;
  }

  .sidebar {
    padding: 12px;
  }

  .brand {
    min-height: 46px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .sheet-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 14px;
  }

  .nav-item {
    justify-content: center;
    height: 40px;
    padding: 0 8px;
    gap: 6px;
    font-size: 12px;
  }

  .nav-item span {
    display: none;
  }

  .sidebar-card {
    display: none;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 8px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 16px;
  }

  .panel {
    padding: 14px;
  }

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

  .review-meter {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .review-meter strong {
    font-size: 28px;
  }

  .upward-chart {
    height: 58px;
  }

  .week-calendar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar-day {
    min-height: 104px;
  }

  .filter-segment {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .research-score {
    grid-template-columns: 1fr;
  }

  .quality-bars {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .journal-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .top-actions button,
  .top-actions .sync-pill,
  .top-actions .save-pill {
    justify-content: center;
    width: 100%;
    min-height: 38px;
    white-space: normal;
    text-align: center;
  }

  .sheet-nav,
  .index-grid,
  .sector-grid,
  .week-calendar,
  .decision-fields,
  .task-row {
    grid-template-columns: 1fr;
  }

  .calendar-day {
    min-height: 92px;
  }

  .market-state,
  .status-badge,
  .sync-pill,
  .save-pill {
    border-radius: 8px;
  }

  .table-actions,
  .decision-card-actions {
    flex-direction: column;
  }

  .table-actions .text-button,
  .table-actions .danger-button,
  .decision-card-actions button {
    width: 100%;
  }

  .toast {
    top: 12px;
    right: 12px;
    left: 12px;
    text-align: center;
  }
}

@media (max-width: 430px) {
  .top-actions {
    grid-template-columns: 1fr;
  }

  .sheet-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .segment,
  .inline-actions {
    flex-wrap: wrap;
  }

  .segment button,
  .inline-actions button {
    min-width: calc(50% - 4px);
  }

  .journal-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quality-bars {
    grid-template-columns: 1fr;
  }
}
