/* ============================================================
   깨알도구
   저축 목표 계산기
   tool.css
   ============================================================ */

.tool-page {
  --tool-page-max-width: 960px;
}

.savings-calculator {
  align-items: start;
}

/* ============================================================
   MODE
   ============================================================ */

.savings-mode-options {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 7px;
}

.savings-mode-button {
  display: flex;

  min-height: 61px;

  flex-direction: column;
  align-items: flex-start;
  justify-content: center;

  gap: 3px;

  padding: 9px 11px;

  border: 1px solid var(--line);

  border-radius: 10px;

  background: #fff;

  color: var(--text);

  text-align: left;

  cursor: pointer;
}

.savings-mode-button strong {
  font-size: 12px;

  font-weight: 900;
}

.savings-mode-button span {
  color: var(--text-soft);

  font-size: 12px;
}

.savings-mode-button:hover {
  background: var(--surface-soft);
}

.savings-mode-button.active {
  border-color: var(--brand);

  background: var(--surface-soft);
}

/* ============================================================
   FORM
   ============================================================ */

.input-title {
  margin-top: 6px;
}

.optional-label {
  display: inline-block;

  margin-left: 4px;

  padding: 1px 5px;

  border-radius: 999px;

  background: var(--surface-soft);

  color: var(--text-soft);

  font-size: 12px;

  font-weight: 700;
}

.savings-period-grid {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 8px;
}

/* ============================================================
   QUICK PERIOD
   ============================================================ */

.period-quick-buttons {
  display: grid;

  grid-template-columns: repeat(4, minmax(0, 1fr));

  gap: 5px;

  margin-top: -3px;
}

.period-quick-buttons button {
  min-height: 31px;

  border: 1px solid var(--line);

  border-radius: 8px;

  background: #fff;

  color: var(--text-soft);

  font-size: 12px;

  font-weight: 800;

  cursor: pointer;
}

.period-quick-buttons button:hover {
  background: var(--surface-soft);

  color: var(--text);
}

/* ============================================================
   PROGRESS
   ============================================================ */

.savings-progress-box {
  margin-top: 16px;

  padding: 11px 12px;

  border: 1px solid var(--line);

  border-radius: 11px;

  background: #fff;
}

.savings-progress-head {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 10px;
}

.savings-progress-head span {
  color: var(--text-soft);

  font-size: 12px;
}

.savings-progress-head strong {
  color: var(--text);

  font-size: 12px;

  font-weight: 900;
}

.savings-progress-track {
  height: 9px;

  margin-top: 8px;

  overflow: hidden;

  border-radius: 999px;

  background: var(--surface-soft);
}

.savings-progress-track span {
  display: block;

  width: 0;
  height: 100%;

  border-radius: inherit;

  background: var(--brand);

  transition: width 0.3s ease;
}

.savings-progress-values {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 10px;

  margin-top: 6px;
}

.savings-progress-values span {
  color: var(--text-soft);

  font-size: 12px;
}

/* ============================================================
   CORE
   ============================================================ */

.savings-core-grid {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 7px;

  margin-top: 12px;
}

.savings-core-card {
  min-width: 0;

  padding: 13px 9px;

  border: 1px solid var(--line);

  border-radius: 11px;

  background: #fff;

  text-align: center;
}

.savings-core-card span {
  display: block;

  color: var(--text-soft);

  font-size: 12px;
}

.savings-core-card strong {
  display: block;

  margin-top: 4px;

  color: var(--brand);

  font-size: 15px;

  font-weight: 900;

  overflow-wrap: anywhere;
}

/* ============================================================
   RESULT GRID
   ============================================================ */

.savings-result-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));

  margin-top: 10px;
}

/* ============================================================
   ASSUMPTION
   ============================================================ */

.savings-assumption-box {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 10px;

  margin-top: 11px;

  padding: 9px 10px;

  border-radius: 9px;

  background: var(--surface-soft);
}

.savings-assumption-box span {
  color: var(--text-soft);

  font-size: 12px;
}

.savings-assumption-box strong {
  color: var(--text);

  font-size: 12px;

  font-weight: 900;

  text-align: right;
}

/* ============================================================
   PLAN SECTION
   ============================================================ */

.savings-plan-section {
  margin-top: 18px;

  padding: 20px;

  border: 1px solid var(--line);

  border-radius: var(--tool-panel-radius);

  background: #fff;
}

.savings-plan-head {
  display: flex;

  align-items: flex-start;
  justify-content: space-between;

  gap: 12px;

  margin-bottom: 13px;
}

.savings-plan-head h2 {
  margin: 0;

  color: var(--text);

  font-size: 16px;

  font-weight: 900;
}

.savings-plan-head p {
  margin: 4px 0 0;

  color: var(--text-soft);

  font-size: 12px;

  line-height: 1.5;
}

.savings-plan-head > span {
  flex: 0 0 auto;

  padding: 5px 8px;

  border-radius: 999px;

  background: var(--surface-soft);

  color: var(--text-soft);

  font-size: 12px;

  font-weight: 800;

  white-space: nowrap;
}

/* ============================================================
   PLAN TABLE
   ============================================================ */

.savings-plan-table {
  width: 100%;

  overflow-x: auto;

  border: 1px solid var(--line);

  border-radius: 11px;

  background: #fff;

  -webkit-overflow-scrolling: touch;
}

.savings-plan-scroll {
  min-width: 670px;
}

.savings-plan-row {
  display: grid;

  grid-template-columns:
    76px
    1.1fr
    1fr
    1.1fr
    80px;

  align-items: center;

  min-height: 42px;

  border-bottom: 1px solid #efeee9;
}

.savings-plan-row:last-child {
  border-bottom: 0;
}

.savings-plan-row > div {
  padding: 7px 9px;

  color: var(--text);

  font-size: 12px;

  font-weight: 600;

  text-align: right;

  white-space: nowrap;
}

.savings-plan-row > div:first-child {
  color: var(--text-soft);

  text-align: center;

  font-weight: 800;
}

.savings-plan-header {
  background: var(--surface-soft);
}

.savings-plan-header > div {
  color: var(--text-soft);

  font-size: 12px;

  font-weight: 900;
}

.savings-plan-body .savings-plan-row:last-child {
  background: #faf9f5;
}

.savings-plan-body .savings-plan-row:last-child > div {
  font-weight: 900;
}

/* ============================================================
   GUIDE
   ============================================================ */

.savings-guide-grid {
  display: grid;

  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 8px;

  margin-top: 12px;
}

.savings-guide-note {
  margin-top: 12px;

  padding: 11px 12px;

  border-radius: 10px;

  background: var(--surface-soft);
}

.savings-guide-note strong {
  color: var(--text);

  font-size: 12px;

  font-weight: 900;
}

.savings-guide-note p {
  margin: 5px 0 0;

  color: var(--text-soft);

  font-size: 12px;

  line-height: 1.6;
}

/* ============================================================
   TABLET
   ============================================================ */

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

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 560px) {
  .savings-mode-options {
    grid-template-columns: 1fr;
  }

  .savings-mode-button {
    min-height: 49px;

    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .savings-mode-button strong {
    font-size: 12px;
  }

  .savings-mode-button span {
    font-size: 12px;

    text-align: right;
  }

  .savings-core-card strong {
    font-size: 13px;
  }

  .savings-plan-section {
    padding: 14px 8px;
  }

  .savings-plan-head {
    padding: 0 4px;
  }

  .savings-plan-head h2 {
    font-size: 14px;
  }

  .savings-plan-head p {
    font-size: 12px;
  }

  .savings-plan-scroll {
    min-width: 630px;
  }

  .savings-plan-row > div {
    font-size: 12px;
  }

  .savings-plan-header > div {
    font-size: 12px;
  }

  .savings-guide-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   VERY SMALL
   ============================================================ */

@media (max-width: 380px) {
  .period-quick-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .savings-period-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
