* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  background: #f4f6f8;
  color: #1f2937;
}

header {
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  color: white;
  padding: 48px 24px;
  text-align: center;
}

header h1 {
  margin: 0 0 12px;
  font-size: 36px;
}

header p {
  margin: 0;
  font-size: 17px;
  color: #dbeafe;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

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

.card {
  background: white;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  margin-bottom: 24px;
}

.card h2 {
  margin-top: 0;
  font-size: 22px;
  color: #0f172a;
}

.card h3 {
  margin-bottom: 10px;
  color: #1e40af;
}

label {
  display: block;
  font-weight: 600;
  margin: 16px 0 6px;
}

input, select {
  width: 100%;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 15px;
  background: #fff;
}

.checkbox-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 14px;
}

.checkbox-item input {
  width: auto;
}

button {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 16px;
  background: #1d4ed8;
  color: white;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 20px;
}

button:hover {
  background: #1e40af;
}

.result-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px;
  margin-top: 14px;
}

.profile-badge {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e40af;
  font-weight: 700;
  margin: 4px 4px 4px 0;
}

.allocation-row {
  margin: 14px 0;
  position: relative;
}

.linked-cash-row {
  border: 2px solid #38bdf8;
  background: linear-gradient(90deg, #ecfeff, #fff7ed);
  border-radius: 14px;
  padding: 12px;
  margin: 8px -8px 18px;
  box-shadow: 0 8px 18px rgba(56, 189, 248, 0.18);
}

.linked-cash-row .allocation-label {
  color: #075985;
}


.allocation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 12px;
  position: relative;
  overflow: visible;
}



.allocation-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px;
  position: relative;
}

.total-allocation-panel {
  z-index: 3;
}

.cash-allocation-panel {
  z-index: 1;
  border-color: #bfdbfe;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.08);
}


.allocation-panel h4 {
  margin: 0 0 6px;
  font-size: 18px;
  color: #0f172a;
}

.allocation-note {
  margin: 0 0 16px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}

.allocation-amount {
  color: #475569;
  font-size: 13px;
  font-weight: 500;
}

.allocation-label {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 6px;
}

.bar {
  width: 100%;
  height: 16px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
}

.cash { background: #38bdf8; }
.bond { background: #60a5fa; }
.deposit { background: #93c5fd; }
.domestic { background: #fb923c; }
.global { background: #22c55e; }
.alt { background: #a855f7; }
.realestate { background: #facc15; }

.summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 14px;
}

.summary-table th,
.summary-table td {
  border: 1px solid #e2e8f0;
  padding: 10px;
  text-align: left;
}

.summary-table th {
  background: #eff6ff;
}

.warning {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  padding: 14px;
  border-radius: 12px;
  margin-top: 14px;
  font-size: 14px;
}

.ips-report {
  white-space: pre-line;
  line-height: 1.75;
  background: #0f172a;
  color: #e5e7eb;
  padding: 24px;
  border-radius: 16px;
  font-size: 15px;
}



.ai-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 700;
  margin-bottom: 14px;
}

.ai-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.ai-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: #ecfeff;
  border: 1px solid #bae6fd;
  color: #075985;
  font-size: 13px;
  font-weight: 700;
}

.ai-insight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}

.ai-insight {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px;
  line-height: 1.6;
}

.ai-insight strong {
  color: #1e40af;
  display: block;
  margin-bottom: 6px;
}

.ai-action-list {
  margin: 8px 0 0 18px;
  padding: 0;
  line-height: 1.7;
}

.ai-disclaimer {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 13px;
  line-height: 1.6;
}

footer {
  text-align: center;
  color: #64748b;
  padding: 30px;
  font-size: 13px;
}

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

  header h1 {
    font-size: 28px;
  }

  .checkbox-group {
    grid-template-columns: 1fr;
  }

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

  .allocation-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .allocation-grid::before,
  .allocation-grid::after,
  .linked-cash-row::before,
  .cash-allocation-panel::before {
    display: none;
  }
}

.money-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 6px;
}

.money-label-row label {
  margin: 0;
}

.inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
  margin: 0;
}

.inline-checkbox input {
  width: auto;
  margin: 0;
}

.linked-cash-row {
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 14px 0;
  box-shadow: none;
}

.linked-cash-row .allocation-label {
  color: inherit;
}

.linked-cash-row::before,
.allocation-grid::before,
.allocation-grid::after,

.allocation-grid {
  gap: 24px;
}
