:root {
  color-scheme: dark;
  --ink: #e7f0f5;
  --muted: #a9bbc6;
  --navy: #101e2e;
  --panel: #172b3e;
  --line: #294257;
  --mint: #6ee7d7;
  --red: #ffb4bd;
  font-family: "Microsoft JhengHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 82% 5%, #203f58 0, #101e2e 35rem, #0c1622 100%);
}
.shell { width: min(1320px, calc(100% - 48px)); margin: 28px auto 48px; }
header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
h1 { margin: 0 0 8px; font-size: clamp(1.8rem, 4vw, 2.7rem); letter-spacing: .02em; }
.version { display: inline-block; margin-left: 10px; padding: 3px 8px; border: 1px solid #4f6d80; border-radius: 999px; color: #9be9df; font-size: .72rem; font-weight: 700; vertical-align: middle; letter-spacing: .06em; }
.intro { margin: 0; color: var(--muted); line-height: 1.6; }
.pill { flex: none; border: 1px solid #416178; border-radius: 999px; color: var(--mint); font-size: .82rem; padding: 7px 11px; }
.card { padding: clamp(18px, 4vw, 30px); border: 1px solid #2b4860; border-radius: 16px; background: rgba(23, 43, 62, .86); box-shadow: 0 16px 44px #02070d55; }
label { display: block; margin: 14px 0 7px; font-size: .94rem; font-weight: 700; }
.form-block { padding: 2px 0; }
.fund-workspace { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
.fund-workspace > * { min-width: 0; }
.selected-panel { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #142638; }
.selected-panel .field-meta { flex-wrap: wrap; gap: 8px; }
.selected-panel .selected-funds { max-height: 340px; overflow-y: auto; scrollbar-gutter: stable; }
.section-title { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.section-title label { margin: 0 0 3px; font-size: 1.04rem; }
.section-subtitle { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.55; }
.step-number { display: grid; flex: none; place-items: center; width: 28px; height: 28px; border: 1px solid #4a8a8b; border-radius: 50%; color: var(--mint); font-size: .84rem; font-weight: 800; }
textarea, select, input, button { font: inherit; }
textarea, select, input[type="date"], input[type="search"] { width: 100%; padding: 11px 12px; border: 1px solid #456077; border-radius: 9px; background: #0f2031; color: var(--ink); font-size: 1rem; }
textarea { min-height: 95px; resize: vertical; line-height: 1.5; }
textarea:focus, select:focus, input:focus { outline: 2px solid var(--mint); outline-offset: 1px; }
.hint { margin: 7px 0 0; color: var(--muted); font-size: .83rem; line-height: 1.55; }
.hint.error { color: var(--red); }
.selected-funds { list-style: none; margin: 12px 0; padding: 0; }
.selected-funds:empty { display: none; }
.selected-funds li { display: flex; align-items: center; gap: 16px; justify-content: space-between; padding: 10px 12px; margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; background: #102235; font-size: .9rem; line-height: 1.6; }
.selected-funds li span { overflow-wrap: anywhere; }
.remove-fund { flex: none; padding: 7px 10px; background: #314253; color: var(--ink); }
.selection-actions { display: flex; gap: 10px; margin-top: 12px; }
.fund-detail { margin: 12px 0 0; padding: 12px 14px; border-left: 3px solid var(--mint); background: #18394a; border-radius: 4px; line-height: 1.7; overflow-wrap: anywhere; font-size: .92rem; }
#picker-status:empty { display: none; }
.field-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.selection-count { flex: none; padding: 4px 9px; border-radius: 999px; background: #21494f; color: var(--mint); font-size: .78rem; font-weight: 700; }
.selection-count.over-limit { background: #5a2935; color: var(--red); }
.fund-picker { margin-top: 0; padding: 20px; border: 1px solid #396678; border-radius: 14px; background: #102a3b; }
#search-summary { min-height: 1.55em; color: #c0d7df; }
#fund-options { margin-top: 12px; min-height: 148px; padding: 5px; }
#fund-options option { padding: 6px 8px; }
.picker-actions { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 12px; }
.add-action { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.action-hint { max-width: 20rem; margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.secondary { padding: 10px 14px; border: 1px solid var(--mint); background: #194b50; color: var(--mint); white-space: nowrap; }
.load-more { border-color: #67869a; background: #223d50; color: var(--ink); }
button:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
.period-block { margin-top: 25px; padding-top: 22px; border-top: 1px solid var(--line); }
.field-row { max-width: 260px; }
.date-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; margin-top: 12px; }
button { border: 0; border-radius: 9px; cursor: pointer; font-weight: 800; }
button:hover { filter: brightness(1.08); }
.primary { width: 100%; margin-top: 22px; padding: 12px 16px; background: var(--mint); color: #08202a; }
.status { min-height: 1.5em; margin: 14px 0 0; color: var(--mint); font-size: .88rem; line-height: 1.5; }
.status.error { color: var(--red); }
.result { margin-top: 20px; }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h2 { margin: 0; font-size: 1.12rem; }
#copy-button { padding: 9px 13px; background: #dff6f1; color: #075c57; white-space: nowrap; }
#fund-list { margin: 18px 0; padding-left: 24px; color: var(--muted); line-height: 1.8; }
#result-link { display: block; overflow-wrap: anywhere; padding: 14px; border: 1px solid #456077; border-radius: 9px; background: #0f2031; color: var(--mint); line-height: 1.6; }
footer { margin-top: 25px; color: var(--muted); font-size: .78rem; line-height: 1.6; }
footer p { margin: 4px 0; }
[hidden] { display: none !important; }
@media (max-width: 959px) {
  .fund-workspace { grid-template-columns: minmax(0, 1fr); }
  .selected-panel .selected-funds { max-height: none; }
}
@media (max-width: 700px) {
  .shell { width: min(100% - 32px, 840px); margin-top: 28px; }
  header { display: block; }
  .pill { display: inline-block; margin-top: 14px; }
  .date-row { grid-template-columns: 1fr; }
  .picker-actions, .field-meta { align-items: flex-start; flex-direction: column; }
  .fund-picker { padding: 16px; }
}

