:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d8dee9;
  --accent: #1f5eff;
  --accent-soft: #e9efff;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --shadow: 0 12px 28px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select { font: inherit; }
button {
  border: 0;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 700;
}
button.secondary {
  background: var(--accent-soft);
  color: var(--accent);
}
button:hover { filter: brightness(0.96); }

.app { max-width: 1180px; margin: 0 auto; padding: 32px 20px 56px; }
.hero {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 20px;
  margin-bottom: 22px;
}
.eyebrow { color: var(--accent); font-weight: 800; margin: 0 0 8px; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); margin: 0; letter-spacing: -0.04em; }
.lead { margin: 12px 0 0; color: var(--muted); font-size: 1.04rem; }
.rate-card {
  min-width: 240px;
  background: linear-gradient(135deg, #1f5eff, #0b2f86);
  color: #fff;
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.rate-card span { opacity: .86; }
.rate-card strong { font-size: 2.4rem; margin: 8px 0; }
.rate-card small { opacity: .78; line-height: 1.5; }

.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
}
h2 { margin: 0 0 16px; font-size: 1.22rem; }
label { display: block; margin: 16px 0 8px; font-weight: 800; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  background: #fff;
  color: var(--text);
  min-width: 0;
}
input[type="range"] { padding: 0; margin-top: 10px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; }
.money-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.money-row input {
  text-align: right;
  font-size: 1.08rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  min-height: 48px;
  padding-right: 16px;
}
.money-row span, .rate-edit span { color: var(--muted); white-space: nowrap; }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  margin-left: 4px;
}
.hint { color: var(--muted); font-size: .9rem; margin: 8px 0 0; }
.warning {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #f5b5ae;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 12px 0 0;
}
.hidden { display: none; }
.readonly-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
  color: var(--muted);
}
.step-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.step-buttons button { padding: 8px; background: #eef2f7; color: #344054; font-weight: 700; }
.result-list { margin-top: 10px; display: grid; gap: 8px; }
.addr-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #f8fafc;
  cursor: pointer;
}
.addr-item strong { display: block; }
.addr-item small { display: block; color: var(--muted); margin-top: 3px; }

.result-panel { margin-bottom: 18px; }
.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.result-grid div {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.result-grid span { display: block; color: var(--muted); font-size: .9rem; margin-bottom: 8px; }
.result-grid strong { font-size: 1.25rem; }
.decision {
  margin-top: 14px;
  border-radius: 16px;
  padding: 14px 16px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}
.decision.ok { background: var(--ok-soft); color: var(--ok); }
.decision.bad { background: var(--danger-soft); color: var(--danger); }
.actions { display: flex; gap: 10px; margin-top: 14px; }
.cases { display: grid; gap: 10px; }
.case-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px;
  display: grid;
  gap: 6px;
  background: #fbfcff;
}
.case-item button { justify-self: start; padding: 8px 10px; }
.footnote { color: var(--muted); font-size: .9rem; line-height: 1.6; margin-top: 18px; }

@media (max-width: 900px) {
  .hero, .grid.two { grid-template-columns: 1fr; display: grid; }
  .rate-card { min-width: 0; }
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .inline, .actions { flex-direction: column; align-items: stretch; }
  .step-buttons, .result-grid { grid-template-columns: 1fr; }
  .money-row { grid-template-columns: minmax(0, 1fr) auto; }
  .money-row input { font-size: 1rem; padding-right: 12px; }
}

.law-box {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  padding: 14px;
}
.law-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.law-head span {
  color: var(--muted);
  font-size: .9rem;
  text-align: right;
}
.check-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 10px 0;
  font-weight: 700;
  color: var(--text);
}
.check-row input {
  width: auto;
  margin-top: 3px;
}
.law-input-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.law-input-grid label {
  margin: 8px 0 0;
  font-size: .9rem;
}
.rate-mini-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}
.rate-mini-row input {
  text-align: right;
}
.rate-mini-row span {
  color: var(--muted);
}
.law-actions {
  margin-top: 12px;
}
.law-actions button:disabled,
button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  .law-input-grid { grid-template-columns: 1fr; }
  .law-head { align-items: flex-start; flex-direction: column; }
  .law-head span { text-align: left; }
}

code {
  background: #eef2f7;
  border-radius: 6px;
  padding: 1px 5px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.panel-head h2 { margin: 0; }
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .85rem;
  font-weight: 800;
  white-space: nowrap;
}
.narrow-left { grid-template-columns: minmax(320px, .78fr) minmax(0, 1.22fr) !important; }
.property-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.danger-text { color: var(--danger) !important; background: var(--danger-soft) !important; }
.property-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding-right: 2px;
}
.property-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fbfcff;
  color: var(--text);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 4px;
}
.property-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.property-item strong { font-size: 1rem; }
.property-item span,
.property-item small {
  color: var(--muted);
  line-height: 1.45;
}
.active-result-grid { margin-top: 12px; }
.summary-grid { margin: 12px 0 14px; }
.compact-actions { margin-top: 0; }
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.property-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: #fff;
}
.property-table th,
.property-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.property-table th {
  background: #f8fafc;
  color: var(--muted);
  font-size: .88rem;
}
.property-table td small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}
.property-table tr:last-child td { border-bottom: 0; }
.property-table tr.active-row td { background: #f7f9ff; }
.link-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  border-radius: 0;
  font-weight: 900;
  cursor: pointer;
}
.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .84rem;
  font-weight: 900;
  white-space: nowrap;
}
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.bad { background: var(--danger-soft); color: var(--danger); }
.status.neutral { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 900px) {
  .narrow-left { grid-template-columns: 1fr !important; }
  .property-actions { grid-template-columns: 1fr; }
  .compact-actions { flex-direction: column; align-items: stretch; }
}
