:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --line: #d7e0ea;
  --soft-line: #e8edf3;
  --text: #1f2a3d;
  --muted: #69778b;
  --brand: #0787c5;
  --brand-soft: #eef9ff;
  --danger: #bd3d42;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; }

button, input { font: inherit; }

button { cursor: pointer; }

.page { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 40px 0 56px; }

.loading, .error-panel {
  margin: 80px auto;
  width: min(540px, 100%);
  padding: 28px;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.error-panel { color: var(--danger); }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 22px;
  margin-bottom: 28px;
  border-bottom: 1px solid #cbd7e4;
}

.title { display: flex; align-items: center; gap: 11px; margin: 0; font-size: clamp(22px, 3vw, 30px); letter-spacing: -0.06em; }
.title-mark { display: inline-block; width: 9px; height: 28px; background: var(--brand); border-radius: 2px; }
.subtitle { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.reset-button {
  flex: 0 0 auto;
  padding: 10px 18px;
  color: #405068;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid #bcc9d8;
  border-radius: 7px;
}
.reset-button:hover { background: #f2f7fb; }
.reset-button:focus-visible, input:focus-visible { outline: 3px solid rgba(7, 135, 197, .24); outline-offset: 1px; }

.overview { display: grid; grid-template-columns: 5fr 4fr 3fr; gap: 22px; }
.panel, .tier-card { background: var(--surface); border: 1px solid var(--soft-line); border-radius: 12px; box-shadow: 0 2px 7px rgba(26, 52, 82, .05); }
.panel { padding: 19px; }
.panel h2 { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 14px; font-size: 17px; letter-spacing: -0.04em; }
.panel-hint { color: var(--muted); font-size: 12px; font-weight: 500; }
.editable-badge { padding: 3px 7px; color: var(--brand); font-size: 12px; background: var(--brand-soft); border-radius: 4px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 370px; }
th, td { padding: 11px 12px; border: 1px solid var(--line); font-size: 14px; }
th { color: #44536a; font-weight: 700; text-align: center; white-space: nowrap; background: #f1f5f9; }
td { background: #fff; }
.item-label { font-weight: 700; }
.item-note { display: block; margin-top: 3px; color: #8a98aa; font-size: 12px; font-weight: 500; }
.number-cell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.total-row td { color: #1e344f; font-weight: 800; background: #eef5fa; }
.total-row .number-cell { color: var(--brand); }

.quote-table td:first-child { min-width: 155px; }
.mobile-label { display: none; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.number-input {
  width: 100%;
  min-width: 106px;
  padding: 8px 9px;
  color: #24344b;
  font-weight: 750;
  text-align: right;
  background: #fff;
  border: 1px solid #9aaabd;
  border-radius: 4px;
}
.readonly-input { color: #99a6b6; background: #f2f5f8; cursor: not-allowed; }
.input-unit { margin-left: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.input-with-unit { display: flex; align-items: center; }

.annual-table td:first-child { width: 35%; text-align: center; font-weight: 750; }

.section-title { display: flex; align-items: baseline; gap: 10px; margin: 42px 0 16px; font-size: 21px; letter-spacing: -0.05em; }
.section-title span { color: var(--muted); font-size: 13px; font-weight: 500; letter-spacing: -0.02em; }
.tiers { display: grid; gap: 20px; }
.tier-card { padding: 20px; overflow: hidden; }
.tier-heading { display: flex; align-items: center; gap: 9px; margin: 0 0 15px; font-size: 16px; }
.tier-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.tier-card[data-service="call"] .tier-dot { background: #17a76d; }
.tier-card[data-service="notice"] .tier-dot { background: #f59e0b; }
.tier-card[data-service="recipient"] .tier-dot { background: #8359e8; }
.tier-table { min-width: 880px; }
.tier-table th:first-child, .tier-table td:first-child { width: 146px; color: #526177; font-weight: 750; background: #f7f9fb; }
.tier-table td { text-align: center; }
.rate-input { width: 88px; min-width: 0; padding: 7px; text-align: center; }
.tier-amount { color: #3a4b63; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.formula { display: block; margin-top: 4px; color: #91a0b0; font-size: 11px; font-weight: 500; }
.footnote { margin: 18px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

@media (max-width: 1050px) {
  .overview { grid-template-columns: 1fr 1fr; }
  .annual-panel { grid-column: span 2; }
}

@media (max-width: 680px) {
  .page { width: min(100% - 28px, 560px); padding-top: 25px; }
  .topbar { gap: 16px; }
  .subtitle { font-size: 13px; }
  .reset-button { padding: 9px 12px; }
  .overview { grid-template-columns: 1fr; gap: 16px; }
  .annual-panel { grid-column: auto; }
  .panel, .tier-card { padding: 14px; }
  .mobile-label { display: block; }
  .section-title { display: block; margin-top: 32px; font-size: 19px; }
  .section-title span { display: block; margin-top: 5px; line-height: 1.4; }
}

@media print {
  :root { background: #fff; }
  .page { width: 100%; padding: 0; }
  .reset-button { display: none; }
  .panel, .tier-card { box-shadow: none; }
}
