* {
  box-sizing: border-box;
}

:root {
  --blue: #2563ff;
  --cyan: #10d4d2;
  --nav: #070b14;
  --bg: #f3f6fb;
  --line: #dce3ee;
  --text: #111827;
  --muted: #7a869b;
  --green: #19b36b;
  --orange: #f59e0b;
  --red: #ef4444;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Pretendard", "Noto Sans KR", Arial, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}

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

button,
input,
textarea {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--nav);
  color: #d7deec;
}

.logo {
  padding: 24px 28px 28px;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
}

.nav-group {
  padding: 0 16px;
}

.nav-label {
  margin: 0 0 10px 10px;
  color: #56627a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  margin-bottom: 6px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #8f9bb2;
  font-size: 14px;
  font-weight: 700;
}

.nav-item::before {
  content: attr(data-icon);
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: #738097;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
  text-align: center;
}

.nav-item[data-icon="⌕"]::before {
  font-size: 22px;
}

.search-line-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--blue);
  vertical-align: -4px;
}

.chat-line-icon,
.report-line-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--blue);
  vertical-align: -4px;
}

.chat-line-icon {
  border: 2px solid currentColor;
  border-radius: 2px;
}

.chat-line-icon::before,
.chat-line-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.chat-line-icon::before {
  top: 5px;
  width: 8px;
}

.chat-line-icon::after {
  top: 9px;
  width: 7px;
}

.report-line-icon {
  border: 2px solid currentColor;
  border-radius: 2px;
}

.report-line-icon::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 7px;
  width: 7px;
  height: 7px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.report-line-icon::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor;
}

.search-line-icon::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.search-line-icon::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 11px;
  width: 6px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: left center;
}

.nav-item.active {
  border-color: #2364ff;
  background: #0c1b44;
  color: #fff;
  box-shadow: 0 0 16px rgba(37, 99, 255, .28);
}

.nav-item.active::after {
  content: "";
  position: absolute;
  left: -16px;
  top: 9px;
  width: 3px;
  height: 24px;
  border-radius: 999px;
  background: var(--cyan);
}

.nav-chevron {
  color: #93a0b9;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 18px 16px;
  border-top: 1px solid #151b28;
}

.avatar {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #e8efff;
  color: #174ce6;
  font-size: 12px;
  font-weight: 900;
}

.user-name {
  color: #fff;
  font-weight: 800;
}

.user-team {
  color: #738097;
  font-size: 12px;
}

.gear {
  margin-left: auto;
  color: #77849b;
}

.main {
  min-width: 0;
}

.topbar {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid #e6ebf3;
  background: #fff;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #d8faf4;
  color: #007f75;
  font-size: 11px;
  font-weight: 900;
}

.live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00a99d;
}

.top-actions {
  display: flex;
  gap: 18px;
  margin-left: auto;
  color: #738097;
  font-size: 18px;
}

.content {
  padding: 22px 26px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(20, 30, 50, .08);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #1f2937;
  font-weight: 800;
}

.btn.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #526079;
  font-size: 12px;
  font-weight: 800;
}

.pill.active {
  border-color: #8fb0ff;
  background: #eff5ff;
  color: var(--blue);
}

.icon-box {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  background: #eef4ff;
  color: var(--blue);
  font-size: 17px;
  font-weight: 900;
}

.switch {
  width: 32px;
  height: 18px;
  padding: 2px;
  border-radius: 999px;
  background: var(--blue);
}

.switch::after {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  margin-left: auto;
  border-radius: 50%;
  background: #fff;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.status.green {
  background: #dcf8e9;
  color: #0b8a4a;
}

.status.orange {
  background: #fff1d8;
  color: #b96b00;
}

.status.blue {
  background: #eef4ff;
  color: #2563ff;
}

.status.gray {
  background: #eef1f6;
  color: #475569;
}

.switch.off {
  background: #c7d0de;
}

.switch.off::after {
  margin-left: 0;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  padding: 12px 16px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-weight: 800;
  opacity: 0;
  transform: translateY(10px);
  transition: .2s ease;
  pointer-events: none;
}

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

.is-loading {
  opacity: .72;
  cursor: wait;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .logo {
    padding-bottom: 18px;
  }

  .nav-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-bottom: 18px;
  }

  .nav-label,
  .user-box,
  .nav-item.active::after {
    display: none;
  }
}

/* ── 공통 모달 ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 12, 22, 0.55);
  backdrop-filter: blur(2px);
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow: hidden;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(8, 12, 22, 0.4);
}

.modal.label-modal {
  max-width: 1080px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
}

.modal-close {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.modal-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.modal-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.modal-form .field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #334155;
}

.modal-form .field input[type="text"],
.modal-form .field select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  font-weight: 600;
}

.modal-form .field.row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

/* 페이지 내 'AI에게 물어보기' (보고서/라벨링 공통) */
.page-ask {
  margin-top: 14px;
  padding: 14px 16px;
}

.page-ask::before {
  content: "✦ AI에게 물어보기";
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.page-ask-row {
  display: flex;
  gap: 8px;
}

.page-ask-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
}

.page-ask-input:focus {
  border-color: #8fb0ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 255, 0.1);
}

.page-ask-row .btn.primary {
  border-radius: 999px;
  padding: 0 18px;
}

.page-ask-answer {
  position: relative;
  margin-top: 12px;
  padding: 14px 16px 14px 48px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f5f9ff, #eef4ff);
  border: 1px solid #dbe6ff;
  line-height: 1.75;
}

.page-ask-answer::before {
  content: "AI";
  position: absolute;
  left: 12px;
  top: 13px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, #2dd4bf, #2563ff);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.page-ask-answer[hidden] {
  display: none;
}

.page-ask-answer p {
  margin: 0 0 6px;
}

.page-ask-answer p:last-child {
  margin-bottom: 0;
}

/* ── 사용법 모달 (?) ────────────────────────────────────────────── */
.help-trigger {
  font-weight: 900;
}

.help-slide {
  padding: 4px 2px;
}

.help-badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.help-title {
  margin: 0 0 12px;
  font-size: 19px;
}

.help-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.help-list li {
  line-height: 1.7;
  color: var(--text);
}

.help-foot {
  align-items: center;
  justify-content: space-between;
}

.help-dots {
  display: inline-flex;
  gap: 6px;
}

.help-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
}

.help-dot.on {
  background: var(--blue);
}
