:root {
  --bg: #f2f4f6;
  --surface: #ffffff;
  --surface-soft: #f7faff;
  --surface-muted: #f8fafc;
  --line: #e5e8eb;
  --line-strong: #d6dbe1;
  --text: #191f28;
  --text-soft: #4e5968;
  --text-muted: #8b95a1;
  --brand: #3182f6;
  --brand-deep: #1b64da;
  --brand-soft: #eaf2ff;
  --green: #16b364;
  --green-soft: #e8f8ef;
  --amber: #ff9f0a;
  --amber-soft: #fff4e3;
  --red: #f04452;
  --red-soft: #fff0f1;
  --purple: #7a5af8;
  --purple-soft: #f1edff;
  --navy: #445bff;
  --navy-soft: #edf1ff;
  --shadow-sm: 0 12px 32px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 20px 60px rgba(15, 23, 42, 0.10);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --mono: "JetBrains Mono", monospace;
  --sans: "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(49, 130, 246, 0.08), transparent 28%),
    linear-gradient(180deg, #f7f9fc 0%, var(--bg) 100%);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: none;
  background: none;
  color: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px 18px;
  background: rgba(242, 244, 246, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(229, 232, 235, 0.9);
}

.header-kicker,
.eyebrow,
.meta-chip__label,
.section-tag,
.summary-card__label,
.surface-caption,
.field-label,
.path-rank,
.path-window,
.quick-btn,
.task-status,
.metric-pill__label,
.tab {
  font-family: var(--mono);
}

.header-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--brand-deep);
}

.header-title {
  margin-top: 6px;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
  line-height: 1.2;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.meta-chip {
  min-width: 150px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(229, 232, 235, 0.9);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.meta-chip--blue {
  background: linear-gradient(180deg, #f4f8ff 0%, #edf3ff 100%);
}

.meta-chip__label {
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.meta-chip strong {
  font-size: 14px;
}

.tabs {
  position: sticky;
  top: 98px;
  z-index: 35;
  display: flex;
  gap: 8px;
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  padding: 12px 0 0;
  overflow-x: auto;
}

.tab {
  flex: 0 0 auto;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.18s ease;
}

.tab.active {
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(49, 130, 246, 0.26);
}

.tab:hover:not(.active) {
  border-color: var(--line-strong);
  color: var(--text-soft);
}

.main {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  padding: 16px 0 56px;
}

.panel {
  display: none;
  animation: panel-in 0.22s ease;
}

.panel.active {
  display: block;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 26px;
}

.surface + .surface,
.surface + .two-column,
.surface + .summary-grid,
.summary-grid + .surface,
.summary-grid + .two-column,
.two-column + .surface,
.surface + .section-block,
.section-block + .section-block,
.surface + .action-row {
  margin-top: 18px;
}

.surface-soft {
  background: linear-gradient(180deg, #fcfdff 0%, var(--surface-soft) 100%);
}

.surface-muted {
  background: linear-gradient(180deg, #fbfcfd 0%, var(--surface-muted) 100%);
}

.surface-warn {
  background: linear-gradient(180deg, #fff7f8 0%, #fffafb 100%);
}

.surface-head {
  margin-bottom: 18px;
}

.surface-head--split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.surface-head h3 {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.25;
}

.surface-caption {
  max-width: 320px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: right;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--brand-deep);
  text-transform: uppercase;
}

.eyebrow-invert {
  color: rgba(255, 255, 255, 0.82);
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 24px;
  background: linear-gradient(135deg, #0d6bff 0%, #5a9bff 100%);
  border: none;
  box-shadow: var(--shadow-md);
  color: #ffffff;
}

.hero-title {
  margin-top: 8px;
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 800;
  line-height: 1.1;
}

.hero-body {
  margin-top: 14px;
  max-width: 680px;
  font-size: 16px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.88);
}

.hero-progress {
  margin-top: 24px;
}

.hero-progress__track,
.progress-track {
  overflow: hidden;
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.24);
  border-radius: 999px;
}

.hero-progress__fill,
.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffffff 0%, #cfe2ff 100%);
  transition: width 0.24s ease;
}

.hero-progress__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.86);
}

.hero-aside {
  display: grid;
  gap: 14px;
}

.metric-pill {
  padding: 18px 18px 20px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
}

.metric-pill--soft {
  background: rgba(255, 255, 255, 0.22);
}

.metric-pill__label {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.78);
  text-transform: uppercase;
}

.metric-pill strong {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  line-height: 1.2;
}

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

.summary-card {
  min-height: 154px;
}

.summary-card__label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.summary-card__value {
  display: block;
  margin-top: 18px;
  font-size: clamp(22px, 2.5vw, 34px);
  font-weight: 800;
  line-height: 1.18;
}

.summary-card__sub {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-soft);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 18px;
  margin-top: 18px;
}

.two-column--wide {
  grid-template-columns: minmax(320px, 0.88fr) minmax(0, 1.12fr);
}

.focus-list {
  display: grid;
  gap: 12px;
}

.focus-item {
  width: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  text-align: left;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.focus-item:hover,
.task-item:hover,
.quick-btn:hover,
.export-btn:hover,
.add-btn:hover,
.agent-send:hover {
  transform: translateY(-1px);
}

.focus-item:hover,
.task-item:hover {
  border-color: #c8d3e2;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

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

.focus-item strong {
  display: block;
  margin-top: 10px;
  font-size: 18px;
  line-height: 1.35;
}

.focus-item p {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.6;
}

.focus-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.empty-card {
  padding: 26px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: #fafbfd;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
}

.rule-list {
  display: grid;
  gap: 12px;
  list-style: none;
}

.rule-list li {
  position: relative;
  padding-left: 16px;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.7;
}

.rule-list li::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.rule-list--tight li {
  font-size: 14px;
}

.section-block + .section-block {
  margin-top: 26px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-tag--red {
  background: var(--red-soft);
  color: var(--red);
}

.section-tag--orange {
  background: var(--amber-soft);
  color: #cc7a00;
}

.section-tag--blue {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.section-tag--purple {
  background: var(--purple-soft);
  color: var(--purple);
}

.section-tag--navy {
  background: var(--navy-soft);
  color: var(--navy);
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-soft);
}

.task-grid {
  display: grid;
  gap: 10px;
}

.task-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 14px;
  width: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.task-item.done {
  background: #f9fbfc;
  opacity: 0.64;
}

.task-check {
  position: relative;
  width: 22px;
  height: 22px;
  border: 1.8px solid #c9d2dc;
  border-radius: 50%;
  transition: all 0.16s ease;
}

.task-item.done .task-check {
  border-color: var(--green);
  background: var(--green);
}

.task-item.done .task-check::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 7px;
  width: 5px;
  height: 9px;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(40deg);
}

.task-body {
  min-width: 0;
}

.task-headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.task-name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}

.task-item.done .task-name {
  text-decoration: line-through;
}

.task-sub {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.65;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.task-chip,
.status-chip,
.due-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.task-chip {
  background: #f6f8fb;
  color: var(--text-soft);
}

.status-chip--urgent {
  background: var(--red-soft);
  color: var(--red);
}

.status-chip--wait {
  background: var(--amber-soft);
  color: #cc7a00;
}

.status-chip--ready {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.status-chip--hold {
  background: #eef1f4;
  color: var(--text-muted);
}

.status-chip--legal {
  background: var(--purple-soft);
  color: var(--purple);
}

.due-chip--today {
  background: var(--red-soft);
  color: var(--red);
}

.due-chip--soon {
  background: var(--amber-soft);
  color: #b56f00;
}

.due-chip--safe {
  background: #eef7ff;
  color: var(--brand-deep);
}

.due-chip--hold {
  background: #eef1f4;
  color: var(--text-muted);
}

.export-btn,
.add-btn,
.quick-btn,
.agent-send {
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.export-btn,
.quick-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
}

.export-btn {
  padding: 12px 16px;
  color: var(--brand-deep);
  font-size: 14px;
  font-weight: 700;
}

.notion-output {
  display: none;
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.9;
  white-space: pre-wrap;
}

.notion-output.visible {
  display: block;
}

.panel-copy,
.revenue-hero__copy {
  font-size: 15px;
  color: var(--text-soft);
  line-height: 1.75;
}

.progress-track {
  margin-top: 18px;
  height: 10px;
  background: #edf1f5;
  border-radius: 999px;
}

.progress-track--lg {
  margin-top: 20px;
  height: 14px;
}

.progress-fill {
  background: linear-gradient(90deg, var(--brand) 0%, #76a8ff 100%);
}

.revenue-inputs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.field-label {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.revenue-input,
.agent-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text);
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.revenue-input:focus,
.agent-input:focus {
  border-color: #9dc1ff;
  box-shadow: 0 0 0 4px rgba(49, 130, 246, 0.12);
}

.add-btn,
.agent-send {
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #ffffff;
  font-weight: 700;
}

.add-btn {
  margin-top: 12px;
  padding: 14px 16px;
}

.agent-send {
  min-width: 112px;
  padding: 0 18px;
}

.revenue-log {
  display: grid;
  gap: 10px;
}

.revenue-log-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fbfcfe;
}

.revenue-log-item__date,
.revenue-log-item__amount {
  font-family: var(--mono);
  font-size: 12px;
}

.revenue-log-item__date {
  color: var(--text-muted);
}

.revenue-log-item__source {
  font-size: 15px;
  line-height: 1.6;
}

.revenue-log-item__amount--pos {
  color: var(--green);
}

.revenue-log-item__amount--neg {
  color: var(--red);
}

.path-card {
  margin-top: 18px;
}

.path-card--primary {
  border-color: rgba(49, 130, 246, 0.18);
  background: linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
}

.path-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.path-rank,
.path-window {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.path-rank {
  color: var(--brand-deep);
}

.path-window {
  color: var(--text-muted);
}

.path-title {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.32;
}

.path-copy {
  margin-top: 12px;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.75;
}

.path-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  list-style: none;
}

.path-list li {
  position: relative;
  padding-left: 18px;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.7;
}

.path-list li::before {
  content: "";
  position: absolute;
  top: 11px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

.quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.quick-btn {
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
}

.agent-wrap {
  display: flex;
  flex-direction: column;
  min-height: 600px;
  margin-top: 18px;
}

.agent-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: #fcfdff;
  overflow-y: auto;
}

.msg {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.msg-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

.msg-avatar.ai {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.msg-avatar.user {
  background: #1f2937;
  color: #ffffff;
}

.msg-content {
  max-width: min(780px, 100%);
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #ffffff;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.msg.user .msg-content {
  background: #f4f8ff;
  border-color: #d9e7ff;
}

.msg-loading .msg-content {
  color: var(--text-muted);
}

.agent-input-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  background: #ffffff;
}

.agent-input {
  min-height: 68px;
  border-radius: 16px;
  resize: vertical;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #d7dde5;
  border-radius: 999px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 1080px) {
  .summary-grid,
  .two-column,
  .two-column--wide,
  .hero-card {
    grid-template-columns: 1fr;
  }

  .surface-head--split {
    flex-direction: column;
  }

  .surface-caption {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 720px) {
  .app-header {
    padding: 18px 16px 14px;
    flex-direction: column;
  }

  .header-meta {
    width: 100%;
  }

  .meta-chip {
    flex: 1 1 160px;
    min-width: 0;
  }

  .tabs {
    width: calc(100% - 24px);
    top: 132px;
  }

  .main {
    width: calc(100% - 24px);
    padding-top: 12px;
  }

  .surface {
    padding: 20px;
    border-radius: 24px;
  }

  .hero-title {
    font-size: 30px;
  }

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

  .summary-card {
    min-height: 138px;
  }

  .task-headline {
    flex-direction: column;
  }

  .revenue-log-item {
    grid-template-columns: 1fr;
  }

  .agent-input-row {
    flex-direction: column;
  }

  .agent-send {
    min-height: 48px;
  }
}

@media (max-width: 540px) {
  .app-header {
    position: static;
  }

  .header-title {
    font-size: 28px;
  }

  .tabs {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.94);
    border-top: 1px solid var(--line);
    box-shadow: 0 -16px 32px rgba(15, 23, 42, 0.08);
  }

  .tab {
    flex: 1 1 0;
    padding: 12px 8px;
    text-align: center;
  }

  .main {
    width: calc(100% - 20px);
    padding: 12px 0 100px;
  }

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

  .hero-progress__meta,
  .path-card__top {
    flex-direction: column;
    align-items: flex-start;
  }

  .metric-pill strong,
  .summary-card__value {
    font-size: 24px;
  }
}
