:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Noto Sans KR", sans-serif;
  background: #f2f4f7;
  color: #16181d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  min-height: 100vh;
  padding: 28px;
}

.control-panel,
.results,
.shorts {
  background: #ffffff;
  border: 1px solid #d9dde5;
  border-radius: 8px;
  box-shadow: 0 14px 35px rgba(27, 34, 45, 0.06);
}

.control-panel {
  padding: 24px;
}

.brand-row,
.section-title,
.shorts-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #1d6f62;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.25;
}

h2 {
  font-size: 20px;
}

.primary,
button {
  min-height: 42px;
  border: 1px solid #16181d;
  border-radius: 6px;
  background: #16181d;
  color: #ffffff;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

.secondary {
  width: fit-content;
  min-height: 38px;
  border-color: #c9ced8;
  background: #ffffff;
  color: #16181d;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 360px;
  gap: 18px;
  margin-top: 22px;
  align-items: start;
}

.top-search-panel {
  margin-top: 18px;
  border: 1px solid #e1e5eb;
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.scenario-panel {
  margin-top: 18px;
  border: 1px solid #d9dde5;
  border-radius: 8px;
  background: #111820;
  color: #ffffff;
  padding: 14px;
}

.scenario-panel .top-search-note {
  color: #aeb8c7;
}

.daily-queue-panel {
  margin-top: 18px;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.daily-queue-panel .scenario-card {
  background: #ffffff;
  border-color: #d7dee9;
  color: #111827;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.daily-queue-panel .scenario-card span {
  color: #4b5563;
}

.daily-queue-panel .scenario-card small {
  color: #6b7280;
}

.daily-queue-panel .scenario-card:hover {
  border-color: #111827;
  background: #ffffff;
}

.daily-queue-panel .scenario-loading {
  border-color: #cbd5e1;
  color: #334155;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.scenario-card {
  min-height: 104px;
  border: 1px solid #2d3747;
  border-radius: 8px;
  background: #1d2633;
  color: #ffffff;
  padding: 14px;
  text-align: left;
}

.scenario-card b,
.scenario-card span,
.scenario-card em,
.scenario-card small {
  display: block;
}

.scenario-card b {
  font-size: 15px;
  line-height: 1.25;
}

.scenario-card span {
  margin-top: 7px;
  color: #d4dbe6;
  font-size: 13px;
  line-height: 1.35;
}

.scenario-card em {
  margin-top: 10px;
  color: #60a5fa;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.scenario-card small {
  margin-top: 8px;
  color: #9ca3af;
  font-size: 11px;
  line-height: 1.35;
}

.scenario-card:hover {
  border-color: #60a5fa;
  background: #243044;
}

.scenario-loading {
  grid-column: 1 / -1;
  min-height: 86px;
  border: 1px dashed #334155;
  border-radius: 8px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.scenario-more-row {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  margin-top: 2px;
}

.scenario-more-btn {
  min-width: 160px;
}

.category-panel {
  margin-top: 18px;
  border: 1px solid #d9dde5;
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.top-search-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.top-search-head strong {
  font-size: 16px;
}

.heading-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.heading-inline .top-search-note {
  margin: 0;
  white-space: nowrap;
}

.top-search-head a {
  color: #1769e8;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.mini-button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.top-search-note {
  margin: -2px 0 10px;
  color: #6a7280;
  font-size: 13px;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.category-tab {
  min-height: 34px;
  border-color: #c9ced8;
  background: #ffffff;
  color: #303744;
  padding: 0 10px;
  font-size: 13px;
}

.category-tab.active {
  border-color: #16181d;
  background: #16181d;
  color: #ffffff;
}

.category-stock-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.category-stock {
  min-height: 62px;
  border: 1px solid #d9dde5;
  border-radius: 8px;
  background: #f8fafc;
  color: #16181d;
  padding: 10px;
  text-align: left;
}

.category-stock b,
.category-stock span {
  display: block;
}

.category-stock b {
  font-size: 14px;
}

.category-stock span {
  margin-top: 4px;
  color: #6a7280;
  font-size: 12px;
}

.category-more-row {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  margin-top: 2px;
}

.category-more-btn {
  min-width: 140px;
}

.drop-month-controls {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(140px, 180px);
  gap: 12px;
  align-items: end;
  margin: 8px 0 12px;
}

.drop-year-select select {
  min-width: 140px;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-buttons button,
.year-choice {
  min-height: 38px;
  border-color: #c9ced8;
  background: #ffffff;
  color: #16181d;
  padding: 0 12px;
  font-size: 13px;
}

.year-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}

.year-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #c9ced8;
  border-radius: 6px;
  font-weight: 800;
  cursor: pointer;
}

.year-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.year-choice:has(input:checked) {
  border-color: #16181d;
  background: #16181d;
  color: #ffffff;
}

.top-search-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  color: #6a7280;
  font-size: 13px;
}

.top-stock {
  display: grid;
  gap: 4px;
  min-height: 78px;
  border: 1px solid #d9dde5;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
  color: #16181d;
  text-align: left;
}

.top-stock b {
  font-size: 15px;
}

.top-stock span {
  color: #6a7280;
  font-size: 12px;
}

.stock-editor {
  display: grid;
  gap: 8px;
  align-content: start;
  align-self: start;
  grid-auto-rows: max-content;
}

.bulk-amount {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 104px;
  gap: 10px;
  align-items: end;
  padding: 0 0 4px;
}

.bulk-amount button {
  min-height: 42px;
  height: 42px;
}

.editor-head,
.stock-row {
  display: grid;
  grid-template-columns: 110px minmax(160px, 1fr) 150px 54px 74px;
  gap: 10px;
  align-items: center;
}

.editor-head {
  color: #6a7280;
  font-size: 15px;
  font-weight: 850;
  padding: 0 10px;
}

.stock-rows {
  display: grid;
  gap: 8px;
}

#addRowBtn {
  align-self: start;
  justify-self: start;
  width: auto;
  min-height: 42px;
  height: 42px;
}

.stock-row {
  padding: 10px;
  border: 1px solid #e1e5eb;
  border-radius: 8px;
  background: #f8fafc;
}

.remove-row {
  min-height: 42px;
  border-color: #d9dde5;
  background: #ffffff;
  color: #5f6673;
  padding: 0 10px;
}

label {
  display: grid;
  gap: 8px;
  color: #4f5665;
  font-size: 13px;
  font-weight: 750;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid #c9ced8;
  border-radius: 6px;
  background: #ffffff;
  color: #16181d;
}

textarea {
  min-height: 132px;
  padding: 14px;
  resize: vertical;
  line-height: 1.55;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

input[type="color"] {
  min-height: 42px;
  padding: 4px;
}

.line-color-input {
  min-width: 48px;
}

.settings {
  display: grid;
  gap: 12px;
}

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

.settings-run {
  width: 100%;
  margin-top: 2px;
  min-height: 48px;
  font-size: 16px;
}

.hint {
  margin: 14px 0 0;
  color: #6a7280;
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  margin-top: 22px;
  align-items: start;
}

.results,
.shorts {
  padding: 18px;
  min-width: 0;
}

#status {
  color: #6a7280;
  font-size: 13px;
  font-weight: 750;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.summary-card {
  border: 1px solid #d9dde5;
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.summary-card strong {
  font-size: 16px;
}

.summary-card .money {
  font-size: 20px;
  font-weight: 850;
}

.upload-copy-panel {
  margin-top: 16px;
  border: 1px solid #d9dde5;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}

.upload-copy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 12px;
  margin-top: 12px;
}

.upload-copy-grid textarea {
  min-height: 96px;
}

.copy-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
}

.positive {
  color: #00855a;
}

.negative {
  color: #c53232;
}

.meta {
  color: #6a7280;
  font-size: 12px;
}

.chart-wrap {
  margin-top: 16px;
  border: 1px solid #d9dde5;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.insights-panel {
  margin-top: 16px;
  border: 1px solid #d9dde5;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}

.insights-panel h3 {
  margin: 0;
  font-size: 20px;
}

.insight-note {
  margin: 6px 0 0;
  color: #6a7280;
  font-size: 13px;
}

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

.insight-card {
  border: 1px solid #e1e5eb;
  border-radius: 8px;
  padding: 13px;
  background: #f8fafc;
}

.insight-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
}

.drop-list,
.news-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #303744;
  font-size: 13px;
}

.news-list a {
  color: #1769e8;
  font-weight: 800;
  text-decoration: none;
}

.news-list a:hover {
  text-decoration: underline;
}

.longform-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.longform-actions button {
  max-width: 260px;
}

canvas {
  width: 100%;
  display: block;
  image-rendering: auto;
}

.table-wrap {
  margin-top: 16px;
  overflow: auto;
  max-width: 100%;
}

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

th,
td {
  border-bottom: 1px solid #e5e8ee;
  padding: 10px 8px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

.phone-frame {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  overflow: hidden;
  background: #101216;
  box-shadow: 0 18px 40px rgba(16, 18, 22, 0.2);
}

.music-controls {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d9dde5;
  border-radius: 8px;
  background: #ffffff;
}

.settings .music-controls {
  margin-top: 0;
}

.music-controls input[type="file"] {
  padding: 8px;
}

.music-controls input[type="range"] {
  min-height: 28px;
  padding: 0;
}

.music-controls button {
  width: fit-content;
}

.shorts-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 980px) {
  .shell {
    padding: 16px;
  }

  .brand-row,
  .workspace,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .brand-row,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    display: grid;
    min-width: 0;
  }

  .results,
  .shorts,
  .control-panel {
    width: 100%;
  }

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

  .upload-copy-grid {
    grid-template-columns: 1fr;
  }

  .top-search-list {
    grid-template-columns: 1fr 1fr;
  }

  .category-stock-list {
    grid-template-columns: 1fr 1fr;
  }

  .drop-month-controls {
    grid-template-columns: 1fr;
  }

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

  .bulk-amount {
    grid-template-columns: 1fr;
  }

  .bulk-amount button {
    width: fit-content;
  }

  .editor-head {
    display: none;
  }

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