/* loan — /loan.css（與 tax 同色票邏輯；無整頁／區塊漸層） */

body.page-stocksell {
  font-family: "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
  --p-platinum: #eeeeee;
  --p-inferno: #a80000;
  --p-inferno-hover: #8a0000;
  --p-gunmetal: #424242;
  --p-granite: #958e8a;
  --p-gray-light: #f5f5f5;
  --p-gray-mid: #d0d0d0;
  --p-gray-dark: #2c2c2c;
  --p-surface: #ffffff;
  background: var(--p-gray-light);
  min-height: 100vh;
  color: var(--p-gunmetal);
  font-size: 1.05rem;
}

body.page-stocksell * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body.page-stocksell .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

body.page-stocksell .card {
  background: var(--p-surface);
  border-radius: 1rem;
  border: 1px solid var(--p-gray-mid);
  box-shadow: 0 8px 24px rgba(66, 66, 66, 0.08);
  padding: 2rem 1.5rem;
  margin-bottom: 1.5rem;
}

body.page-stocksell .card-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--p-gunmetal);
  border-bottom: 2px solid var(--p-gray-mid);
  padding-bottom: 0.75rem;
}

body.page-stocksell .section-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--p-inferno);
  margin: 1.5rem 0 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--p-gray-light);
  border-left: 4px solid var(--p-inferno);
  border-radius: 0.35rem;
}

body.page-stocksell .input-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

body.page-stocksell .input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0;
}

body.page-stocksell .input-group label {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--p-gunmetal);
  text-align: center;
  width: 100%;
}

body.page-stocksell .input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 50%;
  margin-left: auto;
  margin-right: auto;
  gap: 0.5rem;
}

body.page-stocksell .input-group input,
body.page-stocksell .input-group select {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 1rem 3.25rem 1rem 1.15rem;
  font-size: 1.45rem;
  font-weight: 700;
  border: 2px solid var(--p-gray-mid);
  border-radius: 0.65rem;
  background: var(--p-platinum);
  color: var(--p-gray-dark);
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

body.page-stocksell .input-group select {
  padding-right: 2.5rem;
  appearance: auto;
}

body.page-stocksell .input-group input:focus,
body.page-stocksell .input-group select:focus {
  outline: none;
  border-color: var(--p-inferno);
  background: var(--p-surface);
  box-shadow: 0 0 0 3px rgba(168, 0, 0, 0.15);
}

body.page-stocksell .input-group input:hover,
body.page-stocksell .input-group select:hover {
  border-color: var(--p-granite);
}

body.page-stocksell .input-unit {
  position: absolute;
  right: 1.1rem;
  font-size: 1.15rem;
  color: var(--p-granite);
  font-weight: 600;
  pointer-events: none;
}

body.page-stocksell .btn-container {
  text-align: center;
  margin: 1.5rem 0;
}

body.page-stocksell .btn {
  background: var(--p-inferno);
  color: #fff;
  border: none;
  padding: 1.05rem 1.75rem;
  font-size: 1.15rem;
  font-weight: 600;
  border-radius: 0.65rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(168, 0, 0, 0.35);
  margin: 0.35rem;
}

body.page-stocksell .btn:hover {
  background: var(--p-inferno-hover);
  transform: translateY(-2px);
}

body.page-stocksell .btn-secondary {
  background: var(--p-surface);
  color: var(--p-gunmetal);
  border: 2px solid var(--p-granite);
  box-shadow: none;
}

body.page-stocksell .btn-secondary:hover {
  background: var(--p-platinum);
  border-color: var(--p-gunmetal);
  transform: translateY(-2px);
}

body.page-stocksell .divider {
  height: 2px;
  background: var(--p-gray-mid);
  margin: 2rem 0;
  opacity: 0.9;
}

body.page-stocksell .summary-box {
  background: var(--p-platinum);
  border: 1px solid var(--p-gray-mid);
  border-radius: 0.75rem;
  padding: 2rem;
  margin: 2rem 0;
}

body.page-stocksell .summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

body.page-stocksell .summary-item {
  background: var(--p-surface);
  padding: 1.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--p-gray-mid);
  border-left: 4px solid var(--p-inferno);
}

body.page-stocksell .summary-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--p-granite);
  margin-bottom: 0.5rem;
}

body.page-stocksell .summary-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--p-gunmetal);
}

body.page-stocksell .summary-highlight {
  background: var(--p-gray-light);
  border: 2px solid var(--p-inferno);
  box-shadow: 0 4px 14px rgba(168, 0, 0, 0.12);
}

body.page-stocksell .summary-highlight .summary-label {
  color: var(--p-gunmetal);
}

body.page-stocksell .summary-highlight .summary-value {
  color: var(--p-inferno);
  font-size: 2rem;
}

body.page-stocksell .info-box {
  background: var(--p-gray-light);
  border: 1px solid var(--p-gray-mid);
  border-left: 4px solid var(--p-inferno);
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}

body.page-stocksell .info-box h4 {
  color: var(--p-inferno);
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

body.page-stocksell .info-box p,
body.page-stocksell .info-box ul,
body.page-stocksell .info-box li {
  color: var(--p-gunmetal);
  font-size: 1.05rem;
  line-height: 1.75;
}

body.page-stocksell .info-box strong {
  color: var(--p-inferno);
}

body.page-stocksell .formula-line {
  background: var(--p-platinum);
  padding: 1rem;
  border-radius: 0.5rem;
  font-family: "Courier New", monospace;
  margin: 1rem 0;
  border: 1px solid var(--p-gray-mid);
  color: var(--p-gray-dark);
  font-weight: 600;
}

body.page-stocksell .tip-box {
  background: var(--p-gray-light);
  border: 1px solid var(--p-gray-mid);
  border-left: 4px solid var(--p-granite);
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}

body.page-stocksell .tip-box h4 {
  color: var(--p-inferno);
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

body.page-stocksell .tip-box p,
body.page-stocksell .tip-box ul {
  color: var(--p-gunmetal);
  font-size: 0.95rem;
  line-height: 1.7;
}

body.page-stocksell .warning-box {
  background: var(--p-gray-light);
  border: 1px solid var(--p-gray-mid);
  border-left: 4px solid var(--p-inferno);
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}

body.page-stocksell .warning-box h4 {
  color: var(--p-inferno);
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

body.page-stocksell .warning-box p {
  color: var(--p-gunmetal);
  font-size: 0.95rem;
  line-height: 1.7;
}

body.page-stocksell .table-container {
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: 0.75rem;
  border: 1px solid var(--p-gray-mid);
}

body.page-stocksell .amortization-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--p-surface);
  font-size: 0.9rem;
}

body.page-stocksell .amortization-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

body.page-stocksell .amortization-table th {
  background: var(--p-inferno);
  color: #fff;
  padding: 1rem 0.75rem;
  text-align: center;
  font-weight: 700;
  white-space: nowrap;
}

body.page-stocksell .amortization-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--p-gray-mid);
  text-align: right;
  color: var(--p-gunmetal);
}

body.page-stocksell .amortization-table tr:hover {
  background: var(--p-platinum);
}

body.page-stocksell .amortization-table .period-cell {
  text-align: center;
  font-weight: 600;
  color: var(--p-gunmetal);
}

body.page-stocksell .amortization-table .year-row {
  background: var(--p-platinum);
  font-weight: 700;
}

body.page-stocksell .amortization-table .year-row td {
  border-top: 2px solid var(--p-gray-mid);
  border-bottom: 2px solid var(--p-gray-mid);
  text-align: center;
  color: var(--p-inferno);
}

body.page-stocksell .fb-plugin-wrap {
  text-align: center;
  padding: 2rem;
}

body.page-stocksell .fb-plugin-wrap__cta-row {
  margin-bottom: 1rem;
}

body.page-stocksell .cta-link {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  background: var(--p-inferno);
  padding: 1rem 2rem;
  border-radius: 0.5rem;
  font-weight: 700;
  font-size: 1.15rem;
  box-shadow: 0 4px 14px rgba(168, 0, 0, 0.25);
  transition: background 0.2s, transform 0.2s;
}

body.page-stocksell .cta-link:hover {
  background: var(--p-inferno-hover);
  transform: translateY(-1px);
}

/* stocksell 專用：雙計算區、手續費、損益板 */
body.page-stocksell .calc-section {
  margin: 1rem 0;
}

/* 買賣損益試算：買入／賣出分區（台股慣例：買入紅、賣出綠） */
body.page-stocksell .calc2-data-blocks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 0.25rem;
}

body.page-stocksell .data-block {
  border-radius: 0.75rem;
  padding: 1.25rem 1rem 1.15rem;
  border: 1px solid var(--p-gray-mid);
  border-left-width: 4px;
}

body.page-stocksell .data-block--buy {
  background: rgba(168, 0, 0, 0.06);
  border-left-color: var(--p-inferno);
  border-color: rgba(168, 0, 0, 0.22);
}

body.page-stocksell .data-block--sell {
  background: rgba(46, 125, 50, 0.07);
  border-left-color: #2e7d32;
  border-color: rgba(46, 125, 50, 0.28);
}

body.page-stocksell .data-block__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  text-align: center;
}

body.page-stocksell .data-block--buy .data-block__title {
  color: var(--p-inferno);
}

body.page-stocksell .data-block--sell .data-block__title {
  color: #2e7d32;
}

body.page-stocksell .data-block .input-group {
  margin-bottom: 0.85rem;
}

body.page-stocksell .data-block .input-group:last-child {
  margin-bottom: 0;
}

body.page-stocksell .data-block .price-input,
body.page-stocksell .data-block .discount-select {
  max-width: 100%;
}

body.page-stocksell .input-row {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

body.page-stocksell .input-group {
  text-align: center;
}

body.page-stocksell .input-label {
  display: block;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--p-gunmetal);
  margin-bottom: 0.65rem;
}

body.page-stocksell .price-input,
body.page-stocksell .discount-select {
  display: block;
  width: 100%;
  max-width: 50%;
  margin-left: auto;
  margin-right: auto;
  padding: 1rem 1.15rem;
  font-size: 1.45rem;
  font-weight: 700;
  border: 2px solid var(--p-gray-mid);
  border-radius: 0.65rem;
  background: var(--p-platinum);
  color: var(--p-gray-dark);
  text-align: center;
}

body.page-stocksell .discount-select {
  font-weight: 600;
  cursor: pointer;
}

body.page-stocksell .board-container {
  margin: 1rem 0;
}

body.page-stocksell .board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

body.page-stocksell .board-item {
  background: var(--p-platinum);
  border: 1px solid var(--p-gray-mid);
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: center;
}

body.page-stocksell .board-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--p-granite);
  margin-bottom: 0.5rem;
}

body.page-stocksell .board-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--p-gunmetal);
}

body.page-stocksell .board-buy {
  color: var(--p-inferno);
  font-size: 2rem;
}

body.page-stocksell .board-sell {
  color: #2e7d32;
  font-size: 2rem;
}

body.page-stocksell .board-profit {
  border-color: var(--p-inferno);
  box-shadow: 0 4px 14px rgba(168, 0, 0, 0.1);
}

body.page-stocksell .board-loss {
  border-color: var(--p-granite);
}

body.page-stocksell .fee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

body.page-stocksell .fee-item {
  background: var(--p-gray-light);
  border: 1px solid var(--p-gray-mid);
  border-radius: 0.5rem;
  padding: 0.75rem;
  text-align: center;
}

body.page-stocksell .fee-label {
  font-size: 0.95rem;
  color: var(--p-granite);
  margin-bottom: 0.35rem;
}

body.page-stocksell .fee-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--p-gunmetal);
}

body.page-stocksell .info-box h4 {
  color: var(--p-inferno);
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

@media (min-width: 640px) {
  body.page-stocksell .calc2-data-blocks {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

@media (max-width: 640px) {
  body.page-stocksell .input-wrapper {
    max-width: 100%;
  }

  body.page-stocksell .price-input,
  body.page-stocksell .discount-select {
    max-width: 100%;
    font-size: 1.25rem;
  }

  body.page-stocksell .input-group input,
  body.page-stocksell .input-group select {
    font-size: 1.25rem;
    padding: 0.9rem 3rem 0.9rem 1rem;
  }

  body.page-stocksell .card-title {
    font-size: 1.65rem;
  }

  body.page-stocksell .section-title {
    font-size: 1.25rem;
  }

  body.page-stocksell .board-value {
    font-size: 1.5rem;
  }

  body.page-stocksell .board-buy,
  body.page-stocksell .board-sell {
    font-size: 1.65rem;
  }
}

@media (min-width: 768px) {
  body.page-stocksell .container {
    padding: 2.5rem 1.5rem;
  }

  body.page-stocksell .card {
    padding: 2.5rem;
  }
}
