/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #005eb8;
  --blue-light: #e3f0ff;
  --blue-mid: #1a6fc4;
  --green: #00a651;
  --orange: #e65100;
  --text: #1a1a1a;
  --text-muted: #666;
  --bg: #f0f2f5;
  --surface: #fff;
  --border: #e0e0e0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text);
}

/* ===== HEADER ===== */
.app-header {
  background: var(--surface);
  border-bottom: 2px solid var(--blue);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,94,184,0.08);
}
.header-inner {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.logo-img {
  height: 36px;
  width: auto;
  flex-shrink: 0;
  object-fit: contain;
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
}

.title-block { flex: 1; }
.app-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}
.title-accent { color: var(--blue); }
.app-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }

.badge-t800 {
  background: var(--text);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 4px;
  line-height: 1.4;
  text-align: center;
  flex-shrink: 0;
}
.badge-t800 span { display: block; font-size: 0.55rem; opacity: 0.7; letter-spacing: 0.12em; }

/* ===== MAIN LAYOUT ===== */
.main-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 780px;
  width: 100%;
  margin: 1.5rem auto;
  padding: 0 1rem 1rem;
  gap: 1rem;
}

/* ===== CHAT PANEL ===== */
.chat-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chat-messages {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 320px;
  max-height: 480px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* ===== MESSAGES ===== */
.message { display: flex; gap: 10px; align-items: flex-start; }
.message.bot { flex-direction: row; }
.message.user { flex-direction: row-reverse; }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700;
  flex-shrink: 0;
}
.avatar.bot { background: var(--blue-light); color: var(--blue-mid); }
.avatar.user { background: #f0f0f0; color: #555; }

.bubble {
  padding: 0.7rem 1rem;
  border-radius: 14px;
  max-width: 80%;
  font-size: 0.88rem;
  line-height: 1.55;
}
.message.bot .bubble {
  background: #f7f8fa;
  color: var(--text);
  border-bottom-left-radius: 4px;
  border: 0.5px solid var(--border);
}
.message.user .bubble {
  background: var(--blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* ===== TYPING ===== */
.typing-dots { display: flex; gap: 5px; padding: 0.2rem 0; align-items: center; }
.typing-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ccc;
  animation: tdot 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes tdot {
  0%,80%,100% { transform:translateY(0); opacity:.5; }
  40% { transform:translateY(-6px); opacity:1; }
}

/* ===== INPUT PANEL ===== */
.input-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem 1.5rem;
}
.step-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.step-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.progress-bar { flex: 1; height: 4px; background: #eee; border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 2px; transition: width 0.4s ease; }
.options-label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.6rem; }
.options-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.opt-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
  font-family: inherit;
}
.opt-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.opt-btn.selected { border-color: var(--blue); background: var(--blue); color: #fff; }
.opt-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.promo-row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.promo-input {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  width: 160px;
  transition: border-color 0.15s;
}
.promo-input:focus { outline: none; border-color: var(--blue); }
.promo-hint { font-size: 0.78rem; color: var(--text-muted); }
.btn-confirm {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-confirm:hover { background: #0047a0; }
.btn-skip {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}
.btn-skip:hover { border-color: #999; color: var(--text); }

/* ===== RESULT CARD ===== */
.result-card {
  border: 2px solid var(--blue);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 0.25rem;
  width: 100%;
  max-width: 100%;
}
.result-header {
  background: var(--blue);
  color: #fff;
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.result-body { padding: 1rem; background: var(--surface); }

.pack-title { font-size: 1.1rem; font-weight: 800; color: var(--blue); margin-bottom: 0.15rem; }
.pack-sub { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; }

.price-row { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.price-public { font-size: 1.4rem; font-weight: 800; color: var(--text); }
.price-promo { font-size: 1.4rem; font-weight: 800; color: var(--green); }
.price-label { font-size: 0.75rem; color: var(--text-muted); }
.price-strikethrough { text-decoration: line-through; color: #aaa; font-size: 1rem; }
.badge-promo { background: #e8f5e9; color: var(--green); font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  margin: 0.75rem 0;
  padding: 0.75rem;
  background: #f7f8fa;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}
.detail-item .di-label { color: var(--text-muted); font-size: 0.72rem; margin-bottom: 2px; }
.detail-item .di-val { font-weight: 600; color: var(--text); font-size: 0.85rem; }
.detail-item.full { grid-column: 1 / -1; }

.asp-box {
  background: var(--blue-light);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.6rem 0.75rem;
  margin: 0.75rem 0;
  font-size: 0.83rem;
}
.asp-box .asp-label { font-size: 0.7rem; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.asp-box .asp-name { font-weight: 700; color: var(--blue-mid); font-size: 0.92rem; }
.asp-box .asp-code { font-family: monospace; background: #fff; border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: 0.8rem; color: var(--text); }

.imperative-box {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: #7a5900;
  margin-top: 0.5rem;
}

.email-section { margin-top: 1rem; }
.email-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}
.email-title { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.copy-btn {
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s;
}
.copy-btn:hover { background: #333; }
.copy-btn.copied { background: var(--green); }

.email-body {
  background: #f7f8fa;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  font-family: inherit;
  max-height: 280px;
  overflow-y: auto;
}

.restart-btn {
  margin-top: 1rem;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 1.2rem;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
  transition: all 0.15s;
}
.restart-btn:hover { border-color: #999; color: var(--text); }

/* ===== TAX CHECKBOX ===== */
.tax-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: #f7f8fa;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  width: fit-content;
}
.tax-row:hover { background: var(--blue-light); border-color: var(--blue); }
.tax-checkbox {
  width: 18px; height: 18px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}
.tax-label { font-size: 0.85rem; color: var(--text); cursor: pointer; }
.tax-label strong { color: var(--blue); }

.ht-badge {
  display: inline-block;
  background: #fff3cd;
  color: #7a5900;
  border: 1px solid #ffe082;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  letter-spacing: 0.04em;
  vertical-align: middle;
  margin-left: 4px;
}
.ttc-badge {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  letter-spacing: 0.04em;
  vertical-align: middle;
  margin-left: 4px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .header-inner { gap: 0.6rem; }
  .app-title { font-size: 1.2rem; }
  .badge-t800 { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .main-layout { margin: 0.75rem auto; }
}
