/* Shopee fee calculator (zh-tw/shopee-fee-calculator).
   The hero reuses the hero-heading section; the tool panel overlaps its
   bottom edge, so the hero gets extra bottom padding and the tool a matching
   negative top margin. */

#section-sfc-hero,
.sfc {
  --sfc-ink: var(--color-black);
  --sfc-ink-2: color-mix(in srgb, var(--color-black) 75%, var(--color-white));
  --sfc-muted: var(--color-gray-500);
  --sfc-line: var(--color-secondary-dark);
  --sfc-bg: var(--color-secondary);
  --sfc-blue: var(--color-primary);
  --sfc-blue-50: var(--color-primary-light);
  --sfc-lime: var(--color-yellow);
  --sfc-red: var(--color-red);
  --sfc-neg-on-dark: var(--color-pink-light);
  --sfc-num: var(--body-font-family);
  --sfc-radius: 16px;
  --sfc-overlap: 4rem;
  --sfc-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.06);

  /* Fee-breakdown chart series; JS references these by name. */
  --sfc-c-commission: var(--color-primary);
  --sfc-c-payment: color-mix(in srgb, var(--color-primary) 55%, var(--color-white));
  --sfc-c-ship: var(--color-orange);
  --sfc-c-preorder: var(--color-purple);
  --sfc-c-coin: var(--color-pink);
  --sfc-c-invoice: var(--color-gray-500);
  --sfc-c-tax: var(--color-gray-300);
  --sfc-c-cost: var(--color-gray-200);
  --sfc-c-other: var(--color-secondary-dark);
  --sfc-c-profit: var(--color-green);
}

/* Hero */
#section-sfc-hero {
  background: radial-gradient(90% 140% at 100% 0%, var(--color-primary) 0%, var(--color-blue-darker, var(--color-primary-dark)) 40%, var(--color-black) 85%);
  padding-bottom: calc(var(--sfc-overlap) + 1rem);
}
#section-sfc-hero::after {
  content: "%";
  position: absolute;
  right: 4%;
  top: -1.5rem;
  font: 900 220px/1 var(--sfc-num);
  color: var(--color-white);
  opacity: 0.06;
  pointer-events: none;
  user-select: none;
}
#section-sfc-hero h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  font-weight: 900;
}
#section-sfc-hero h1 em {
  font-style: normal;
  color: var(--sfc-lime);
}
#section-sfc-hero .sfc-year {
  font-family: var(--sfc-num);
  background: var(--sfc-lime);
  color: var(--sfc-ink);
  padding: 6px 14px 8px;
  border-radius: 14px;
  transform: rotate(-3deg);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--color-yellow) 25%, transparent);
}

/* Tool */
.sfc {
  margin-top: calc(var(--sfc-overlap) * -1);
  padding-bottom: 2.5rem;
  background: linear-gradient(to bottom, transparent var(--sfc-overlap), var(--sfc-bg) var(--sfc-overlap));
  color: var(--sfc-ink);
  line-height: 1.55;
}
.sfc [hidden] {
  display: none !important;
}
.sfc button,
.sfc input,
.sfc select {
  font: inherit;
  color: inherit;
}
.sfc a {
  color: var(--sfc-blue);
}
.sfc h2,
.sfc h3 {
  font-family: var(--body-font-family);
  letter-spacing: normal;
}

.sfc-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}
@media (min-width: 998px) {
  .sfc-layout {
    grid-template-columns: 380px minmax(0, 1fr);
  }
}

.sfc-panel {
  background: var(--color-white);
  border: 1px solid var(--sfc-line);
  border-radius: var(--sfc-radius);
  box-shadow: var(--sfc-shadow);
}

/* Inputs */
.sfc-sec {
  padding: 18px 20px;
  border-bottom: 1px solid var(--sfc-line);
}
.sfc-sec:last-child {
  border-bottom: 0;
}
.sfc-sec h3 {
  display: flex;
  align-items: center;
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--sfc-muted);
}
.sfc-n {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  border-radius: 6px;
  background: var(--sfc-ink);
  color: var(--color-white);
  font: 800 11px/1 var(--sfc-num);
  letter-spacing: 0;
}
.sfc-field {
  margin-bottom: 12px;
}
.sfc-field:last-child {
  margin-bottom: 0;
}
.sfc-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}
.sfc-label small {
  font-size: 12px;
  font-weight: 400;
  color: var(--sfc-muted);
}
.sfc-money {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--sfc-line);
  border-radius: 12px;
  background: var(--color-white);
  transition: border-color 0.15s;
}
.sfc-money:focus-within {
  border-color: var(--sfc-blue);
  box-shadow: 0 0 0 3px var(--sfc-blue-50);
}
.sfc-money span {
  padding: 0 0 0 12px;
  color: var(--sfc-muted);
  font: 600 15px var(--sfc-num);
}
.sfc-money span.sfc-suf {
  padding: 0 12px 0 0;
}
.sfc-money input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 11px 12px;
  font: 700 18px var(--sfc-num);
}
.sfc-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.sfc-seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--sfc-bg);
}
.sfc-seg button {
  flex: 1;
  border: 0;
  border-radius: 9px;
  background: transparent;
  padding: 8px 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--sfc-ink-2);
  white-space: nowrap;
  cursor: pointer;
}
.sfc-seg button[aria-pressed="true"] {
  background: var(--color-white);
  color: var(--sfc-ink);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.12);
}
.sfc-seg--dark button[aria-pressed="true"] {
  background: var(--sfc-ink);
  color: var(--color-white);
}
.sfc select {
  width: 100%;
  appearance: none;
  border: 1.5px solid var(--sfc-line);
  border-radius: 12px;
  padding: 10px 32px 10px 12px;
  font-size: 15px;
  background: var(--color-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center;
}
.sfc select:focus {
  outline: 0;
  border-color: var(--sfc-blue);
}
.sfc-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--sfc-muted);
}
.sfc-hint a {
  font-weight: 600;
}
.sfc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 14px;
  cursor: pointer;
}
.sfc-toggle small {
  display: block;
  font-size: 12px;
  color: var(--sfc-muted);
}
.sfc-toggle input {
  appearance: none;
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: var(--color-gray-200);
  cursor: pointer;
  transition: background 0.15s;
}
.sfc-toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-white);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
  transition: left 0.15s;
}
.sfc-toggle input:checked {
  background: var(--sfc-blue);
}
.sfc-toggle input:checked::after {
  left: 19px;
}
.sfc-more summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.sfc-more summary::-webkit-details-marker {
  display: none;
}
.sfc-more summary small {
  margin-left: auto;
  margin-right: 8px;
  font-weight: 500;
  color: var(--sfc-muted);
}
.sfc-more summary::after {
  content: "＋";
  color: var(--sfc-muted);
}
.sfc-more[open] summary {
  margin-bottom: 12px;
}
.sfc-more[open] summary::after {
  content: "－";
}
.sfc-tbtns {
  display: flex;
  gap: 8px;
}
.sfc-tbtn {
  flex: 1;
  border: 1px solid var(--sfc-line);
  border-radius: 10px;
  background: var(--color-white);
  padding: 9px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.sfc-tbtn:hover {
  border-color: var(--sfc-ink);
}

/* Results */
.sfc-results {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.sfc-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 24px;
  border: 0;
  background: var(--sfc-ink);
  color: var(--color-white);
}
@media (min-width: 641px) {
  .sfc-summary {
    grid-template-columns: 1.2fr 1fr;
  }
}
.sfc-summary .sfc-k,
.sfc-take .sfc-t,
.sfc-summary .sfc-ctx {
  font-size: 13px;
  color: var(--color-white);
  opacity: 0.72;
}
.sfc-summary .sfc-k b {
  font-family: var(--sfc-num);
  opacity: 1;
}
.sfc-big {
  margin: 6px 0;
  font: 800 clamp(36px, 5vw, 52px)/1.05 var(--sfc-num);
  letter-spacing: -0.02em;
}
.sfc-big.is-neg {
  color: var(--sfc-neg-on-dark);
}
.sfc-m {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--sfc-lime);
  color: var(--sfc-ink);
  font: 800 14px/1 var(--sfc-num);
}
.sfc-m.is-neg {
  background: var(--sfc-neg-on-dark);
}
.sfc-summary .sfc-ctx {
  margin-top: 10px;
}
.sfc-take {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  border-top: 1px solid rgb(255 255 255 / 0.15);
  padding-top: 16px;
}
@media (min-width: 641px) {
  .sfc-take {
    border-top: 0;
    border-left: 1px solid rgb(255 255 255 / 0.15);
    padding: 0 0 0 20px;
  }
}
.sfc-take .sfc-v {
  font: 800 26px/1.1 var(--sfc-num);
}
.sfc-take .sfc-v small {
  margin-left: 6px;
  font-size: 15px;
  color: var(--sfc-lime);
}
.sfc-bar,
.sfc-stack {
  display: flex;
  overflow: hidden;
  border-radius: 99px;
}
.sfc-bar {
  height: 10px;
  background: rgb(255 255 255 / 0.15);
}
.sfc-bar i,
.sfc-stack i {
  display: block;
  height: 100%;
}

.sfc-matrix-head {
  padding: 20px 20px 0;
}
.sfc-matrix-head h2,
.sfc-detail h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 700;
}
.sfc-matrix-head p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--sfc-muted);
}
.sfc-matrix {
  display: grid;
  grid-template-columns: 96px repeat(var(--cols, 2), 1fr);
  gap: 10px;
  padding: 16px 20px 20px;
}
.sfc-matrix .sfc-ch,
.sfc-matrix .sfc-rh {
  display: flex;
  font-size: 13px;
  font-weight: 700;
  color: var(--sfc-ink-2);
}
.sfc-matrix .sfc-ch {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.sfc-matrix .sfc-rh {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.sfc-matrix small {
  font-size: 12px;
  font-weight: 500;
  color: var(--sfc-muted);
}
.sfc-matrix.is-one {
  grid-template-columns: 1fr;
}
.sfc-cell {
  position: relative;
  border: 1.5px solid var(--sfc-line);
  border-radius: 14px;
  background: var(--color-white);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s;
}
.sfc-cell:hover {
  border-color: var(--color-gray-300);
}
.sfc-cell[aria-pressed="true"] {
  border-color: var(--sfc-blue);
  box-shadow: 0 0 0 3px var(--sfc-blue-50);
}
.sfc-cell .sfc-p {
  font: 800 24px/1.1 var(--sfc-num);
}
.sfc-cell .sfc-p.is-neg {
  color: var(--sfc-red);
}
.sfc-cell .sfc-s {
  margin-top: 4px;
  font: 12px/1.5 var(--sfc-num);
  color: var(--sfc-muted);
}
.sfc-cell .sfc-s b {
  color: var(--sfc-ink-2);
}
.sfc-best {
  position: absolute;
  top: -9px;
  right: 10px;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--sfc-lime);
  color: var(--sfc-ink);
  font-size: 11px;
  font-weight: 800;
}
.sfc-verdict {
  margin: 0 20px 20px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--sfc-blue-50);
  font-size: 14px;
  color: var(--color-blue-darker, var(--sfc-blue));
}
.sfc-verdict b {
  font-family: var(--sfc-num);
}
@media (max-width: 640px) {
  .sfc-matrix {
    grid-template-columns: 1fr 1fr;
    padding: 14px;
  }
  .sfc-matrix .sfc-corner {
    display: none;
  }
  .sfc-matrix .sfc-rh {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    margin-top: 6px;
  }
  .sfc-matrix.is-one {
    grid-template-columns: 1fr;
  }
  .sfc-cell .sfc-p {
    font-size: 20px;
  }
}

.sfc-detail {
  padding: 20px;
}
.sfc-detail .sfc-sub {
  margin: 2px 0 16px;
  font-size: 13px;
  color: var(--sfc-muted);
}
.sfc-stack {
  height: 14px;
  margin-bottom: 8px;
  background: var(--sfc-bg);
}
.sfc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--sfc-ink-2);
}
.sfc-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sfc-legend span::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--c);
}
.sfc-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.sfc-lines td {
  padding: 9px 0;
  border-bottom: 1px dashed var(--sfc-line);
  vertical-align: top;
}
.sfc-lines td:last-child {
  text-align: right;
  font: 600 15px var(--sfc-num);
  white-space: nowrap;
}
.sfc-lines .sfc-f {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  color: var(--sfc-muted);
  font-family: var(--sfc-num);
}
.sfc-lines tr.is-parent td {
  font-weight: 700;
  padding-top: 14px;
  border-bottom: 0;
}
.sfc-lines tr.is-child td {
  padding: 6px 0 6px 14px;
  border-bottom: 0;
  border-left: 2px solid var(--sfc-line);
  font-size: 13px;
  color: var(--sfc-muted);
}
.sfc-lines tr.is-child td:last-child {
  border-left: 0;
  font: 500 13px var(--sfc-num);
  color: var(--sfc-muted);
}
.sfc-lines tr.is-child .sfc-f {
  font-size: 11px;
}
.sfc-lines tr.is-parent + tr.is-parent td,
.sfc-lines tr.is-child + tr.is-parent td {
  border-top: 1px dashed var(--sfc-line);
}
.sfc-lines tr.is-total td {
  border-bottom: 0;
  border-top: 2px solid var(--sfc-ink);
  padding-top: 12px;
  font-weight: 800;
}
.sfc-lines tr.is-total td:last-child {
  font-size: 20px;
}
.sfc-lines .is-minus {
  color: var(--sfc-red);
}
.sfc-lines .is-zero {
  color: var(--sfc-muted);
}

.sfc-disclaimer {
  margin: 0;
  font-size: 13px;
  color: var(--sfc-muted);
}

/* Dialogs, mobile result bar, toast */
.sfc dialog {
  width: calc(100% - 32px);
  max-width: 420px;
  border: 0;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.25);
}
.sfc dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
}
.sfc-dh {
  padding: 18px 20px;
  border-bottom: 1px solid var(--sfc-line);
  font-weight: 800;
}
.sfc-db {
  max-height: 50vh;
  overflow: auto;
  padding: 16px 20px;
}
.sfc-df {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--sfc-line);
}
.sfc-preset-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--sfc-line);
}
.sfc-preset-item button {
  border: 1px solid var(--sfc-line);
  border-radius: 8px;
  background: var(--color-white);
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
}
.sfc-txtin {
  width: 100%;
  border: 1.5px solid var(--sfc-line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
}
.sfc-btn-p,
.sfc-btn-g {
  border-radius: 10px;
  padding: 9px 16px;
  font-weight: 700;
  cursor: pointer;
}
.sfc-btn-p {
  border: 0;
  background: var(--sfc-ink);
  color: var(--color-white);
}
.sfc-btn-g {
  border: 1px solid var(--sfc-line);
  background: var(--color-white);
}
.sfc a.sfc-btn-g {
  padding: 5px 10px;
  font-size: 13px;
  color: var(--sfc-ink);
  text-decoration: none;
  white-space: nowrap;
}

.sfc-mbar {
  display: none;
}
@media (max-width: 997px) {
  .sfc-mbar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 10px 10px 16px;
    border-radius: 16px;
    background: var(--sfc-ink);
    color: var(--color-white);
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.25);
  }
  .sfc-mbar .sfc-mk {
    font-size: 12px;
    opacity: 0.72;
  }
  .sfc-mbar .sfc-mv {
    font: 800 18px var(--sfc-num);
  }
  .sfc-mbar .sfc-mv small {
    margin-left: 6px;
    font-size: 13px;
    color: var(--sfc-lime);
  }
  .sfc-mbar button {
    border: 0;
    border-radius: 12px;
    background: var(--sfc-lime);
    color: var(--sfc-ink);
    padding: 10px 14px;
    font-weight: 800;
    cursor: pointer;
  }
}

.sfc-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 50;
  transform: translateX(-50%) translateY(80px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--sfc-ink);
  color: var(--color-white);
  font-size: 14px;
  transition: transform 0.2s, opacity 0.2s;
}
.sfc-toast.is-shown {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
