:root {
  color-scheme: light;
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
  font-size: 18px;
  color: #173a63;
  background: #f2f6fb;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-size: 1.1rem; line-height: 1.65; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
a { color: #185a9d; }
:focus-visible { outline: 3px solid #bb7428; outline-offset: 3px; }
[hidden] { display: none !important; }

.skip-link { position: absolute; left: 1rem; top: -5rem; z-index: 20; padding: .5rem 1rem; background: white; }
.skip-link:focus { top: .5rem; }

.site-header { background: #144372; border-bottom: 4px solid #ba8742; color: #fff; }
.header-inner, .page-shell, .footer-inner { max-width: 1200px; margin: 0 auto; }
.header-inner { min-height: 94px; padding: 1rem 2rem; display: flex; align-items: center; gap: 1rem; }
.brand-logo { position: relative; display: block; width: 60px; height: 38px; flex: none; overflow: hidden; }
.brand-logo img { position: absolute; top: -12.5px; left: -32.5px; display: block; width: 125px; height: auto; max-width: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.35; }
.brand-eyebrow { color: #d9e7f5; font-size: .82rem; letter-spacing: .12em; }
.brand-text strong { font-family: "PMingLiU", "Noto Serif TC", serif; font-size: 1.52rem; letter-spacing: .08em; }
.header-login { margin-left: auto; flex: none; min-width: 76px; padding: .35rem .75rem; border: 1px solid #d9e7f5; border-radius: 3px; color: #fff; text-align: center; text-decoration: none; font-size: .9rem; font-weight: 700; }
.header-login:hover, .header-login:focus-visible { background: #225888; }

.page-shell { padding: 2.3rem 2rem 4rem; min-height: calc(100vh - 170px); }
.page-intro { display: flex; justify-content: space-between; align-items: end; gap: 2rem; padding-bottom: 2rem; }
.section-kicker { margin: 0 0 .4rem; color: #43688d; font-size: .82rem; font-weight: 700; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1, .detail-hero h2 { font-family: "PMingLiU", "Noto Serif TC", serif; letter-spacing: .04em; }
h1 { margin-bottom: .5rem; font-size: 2.05rem; line-height: 1.3; }
.intro-note { max-width: 690px; margin-bottom: 0; color: #546e87; }
.source-stamp { min-width: 200px; padding: .7rem 1rem; border-left: 3px solid #ba8742; color: #5a7087; font-size: .78rem; line-height: 1.5; }
.source-stamp span, .source-stamp strong { display: block; }
.source-stamp strong { color: #144372; font-size: .9rem; }

.search-panel { padding: 1.4rem 1.6rem 1.55rem; border: 1px solid #c7d5e3; border-top: 4px solid #144372; background: #fff; box-shadow: 0 3px 10px #132f5010; }
.search-panel h2, .list-heading h2 { font-size: 1.25rem; margin: 0 0 1rem; }
.search-grid { display: grid; grid-template-columns: minmax(250px, 2.2fr) repeat(3, minmax(130px, 1fr)); gap: .9rem; }
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; font-weight: 700; font-size: .82rem; }
.field input, .field select { width: 100%; min-height: 52px; padding: .55rem .8rem; border: 1px solid #afc1d4; border-radius: 3px; background: #fff; color: #173a63; font-weight: 400; font-size: 1rem; }
.field input::placeholder { color: #738498; opacity: 1; }
.field select { appearance: none; padding-right: 2.2rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='m2 2 6 6 6-6' fill='none' stroke='%23144372' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .85rem center; }
.field input:hover, .field select:hover { border-color: #235c96; }
.popular-section { display: flex; align-items: center; gap: .3rem; min-width: 0; margin-top: 1rem; padding: .35rem 0 .45rem; border-bottom: 1px solid #c7d5e3; white-space: nowrap; font-size: .82rem; }
.popular-section h2 { flex: none; margin: 0; font-size: 1em; font-weight: 700; }
.popular-links { display: flex; align-items: center; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.popular-target { flex: none; color: #9f6a00; text-decoration: none; }
.popular-target:hover, .popular-target:focus-visible { text-decoration: underline; }
.popular-separator { flex: none; color: #557587; }
.popular-empty { color: #647a90; }
.popular-section + .list-heading { margin-top: 1.2rem; }

.list-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin: 2.2rem 0 .75rem; }
.list-heading h2 { margin: 0 0 .15rem; }
.list-heading p { margin: 0; color: #526c84; font-size: .88rem; }
.sort-note { color: #657c91; font-size: .78rem; white-space: nowrap; }
.results-frame { border: 1px solid #c7d5e3; background: #fff; }
.column-head, .case-row { display: grid; grid-template-columns: 1.25fr 1.75fr .85fr 1.05fr 1.2fr 3.2rem; align-items: center; gap: .7rem; }
.column-head { padding: .65rem 1.15rem; background: #e8f0f8; border-bottom: 1px solid #c7d5e3; color: #355877; font-size: .78rem; font-weight: 700; }
.case-row { min-height: 84px; padding: .75rem 1.15rem; border-bottom: 1px solid #e1eaf3; text-decoration: none; color: inherit; }
.case-row:last-child { border-bottom: 0; }
.case-row:hover, .case-row:focus-visible { background: #f1f6fc; }
.case-date { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.case-name { font-weight: 700; font-size: 1.07em; color: #144372; }
.case-code { font-variant-numeric: tabular-nums; color: #47647e; }
.market-tag { display: inline-block; width: fit-content; border: 1px solid #a9c3de; border-radius: 2px; padding: .12rem .42rem; color: #1c568b; background: #f2f7fd; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.case-type { color: #526a82; font-size: .88rem; }
.row-open { color: #4c7297; font-size: 1.35rem; text-align: right; line-height: 1; }
.empty-state { padding: 3rem 1.5rem; text-align: center; color: #526a82; }
.empty-state strong { display: block; color: #173a63; font-size: 1.1rem; margin-bottom: .3rem; }
.empty-state p { margin-bottom: 1rem; }
.secondary-button, .back-button, .retry-button { min-height: 48px; padding: .55rem 1.05rem; border: 1px solid #245889; border-radius: 3px; background: #fff; color: #164c7d; font-weight: 700; }
.secondary-button:hover, .back-button:hover, .retry-button:hover { background: #eaf3fc; }
.load-more-wrap { display: flex; justify-content: center; margin: 1.3rem 0; }
.data-note { margin: 1.15rem 0 0; color: #657b90; font-size: .78rem; }

.detail-view { padding-top: .3rem; }
.back-button { margin-bottom: 1.4rem; }
.detail-hero { padding: 1.6rem 1.9rem; border-top: 5px solid #144372; background: #fff; border-inline: 1px solid #c7d5e3; border-bottom: 1px solid #c7d5e3; }
.detail-hero-top { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; margin-bottom: .7rem; }
.detail-hero h2 { font-size: 2.1rem; margin-bottom: .4rem; line-height: 1.35; }
.detail-code { color: #5b7187; font-family: ui-monospace, "Microsoft JhengHei", monospace; font-size: 1.3rem; font-weight: 500; }
.detail-subtitle { color: #526e88; margin-bottom: 0; }
.status-tag { padding: .16rem .55rem; border: 1px solid #aec7de; border-radius: 2px; background: #edf5fc; color: #1d5688; font-size: .78rem; font-weight: 700; }
.status-tag.pending { background: #f8f3e9; border-color: #ddc59f; color: #765422; }
.status-tag.cancelled { background: #f8ecea; border-color: #d9aba5; color: #833d34; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.15rem; margin-top: 1.15rem; }
.detail-card { padding: 1.3rem 1.55rem; border: 1px solid #c7d5e3; background: #fff; }
.detail-card h3 { margin: 0 0 .85rem; padding-bottom: .55rem; border-bottom: 2px solid #d6e4f2; font-size: 1.12rem; }
.detail-card dl { margin: 0; }
.detail-card dl > div { display: flex; justify-content: space-between; gap: 1rem; padding: .56rem 0; border-bottom: 1px solid #e9eef4; }
.detail-card dl > div:last-child { border-bottom: 0; }
.detail-card dt { color: #60758a; }
.detail-card dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.muted-value { color: #74869a; font-weight: 400 !important; }
.order-accordion summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .75rem; align-items: center; list-style: none; cursor: pointer; }
.order-accordion summary::-webkit-details-marker { display: none; }
.order-accordion-heading { grid-column: 1; font-size: 1.12rem; font-weight: 700; }
.order-accordion-brief { grid-column: 1; color: #60758a; font-size: .86rem; }
.order-accordion-arrow { grid-column: 2; grid-row: 1 / 3; color: #4c7297; font-size: 1.35rem; transition: transform .2s; }
.order-accordion[open] .order-accordion-arrow { transform: rotate(180deg); }
.order-accordion[open] summary { padding-bottom: .75rem; border-bottom: 2px solid #d6e4f2; }
.order-accordion dl { margin-top: .7rem; }

.broker-view { max-width: 860px; margin: 0 auto; }
.broker-back { display: inline-flex; align-items: center; text-decoration: none; }
.broker-panel { padding: 1.5rem 1.7rem 1.8rem; border: 1px solid #c7d5e3; border-top: 4px solid #144372; background: #fff; box-shadow: 0 3px 10px #132f5010; }
.broker-panel h1 { margin-bottom: 1.25rem; }
.broker-grid { display: grid; grid-template-columns: 1fr; gap: .7rem; }
.broker-list { max-width: 560px; max-height: 382px; overflow-y: auto; overscroll-behavior: contain; padding-right: .25rem; scrollbar-color: #9eb4ca #eef4fa; }
.broker-card { display: flex; align-items: center; gap: .8rem; min-width: 0; min-height: 82px; padding: .7rem .9rem; border: 1px solid #c7d5e3; background: #fff; color: #173a63; text-align: left; }
.broker-card:hover, .broker-card:focus-visible { border-color: #477cab; background: #f1f6fc; }
.broker-icon { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 54px; height: 54px; overflow: hidden; border: 1px solid #c9d8e8; background: #e6f0fa; color: #185a91; font-size: 1.4rem; font-weight: 700; }
.broker-icon.yuanta { background: #d92828; color: #fff; }
.broker-icon.kgi { background: #174776; color: #fff; }
.broker-icon.fubon { background: #133d83; color: #fff; }
.official-broker-icon { display: block; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.broker-icon-5320 .official-broker-icon, .broker-icon-6110 .official-broker-icon, .broker-icon-5600 .official-broker-icon { width: auto; max-width: none; height: 100%; }
.broker-icon-5600 { background: #144372; }
.broker-icon-5600 .official-broker-icon { background: transparent; }
.kerui-icon { position: relative; background: #fff; }
.kerui-icon img { position: absolute; width: 135px; height: 135px; max-width: none; left: -43px; top: -31px; }
.broker-name { min-width: 0; font-size: 1.04rem; font-weight: 700; }
.broker-chevron { margin-left: auto; color: #4c7297; font-size: 1.4rem; }
.text-button { padding: .45rem 0; border: 0; background: none; color: #205b89; text-decoration: underline; font-size: .85rem; }
.broker-search { position: relative; display: block; max-width: 560px; margin: 0 0 1rem; }
.broker-search input { width: 100%; min-height: 54px; padding: .55rem .8rem .55rem 3rem; border: 1px solid #afc1d4; border-radius: 3px; background: #fff; color: #173a63; font-size: 1rem; }
.broker-search input::placeholder { color: #667b90; opacity: 1; }
.search-icon { position: absolute; top: 50%; left: 1rem; width: 18px; height: 18px; transform: translateY(-58%); border: 2px solid #4d7499; border-radius: 50%; pointer-events: none; }
.search-icon::after { content: ''; position: absolute; width: 9px; height: 2px; right: -7px; bottom: -3px; transform: rotate(45deg); background: #4d7499; }
.broker-loading { margin: .5rem 0; color: #60758a; }
.selected-broker { display: flex; align-items: center; gap: .75rem; margin: .3rem 0 1.3rem; font-size: 1.16rem; }
.broker-phone, .broker-password { max-width: 440px; margin-bottom: 1rem; }
.password-control { position: relative; }
.password-control input { padding-right: 3.2rem; }
.password-toggle { position: absolute; top: 50%; right: .25rem; display: grid; place-items: center; width: 44px; height: 44px; transform: translateY(-50%); border: 0; border-radius: 3px; background: transparent; color: #47647e; }
.password-toggle:hover { background: #eaf3fc; color: #144372; }
.password-toggle[aria-pressed="false"] .eye-slash { display: none; }
.primary-button { min-height: 52px; padding: .55rem 1.25rem; border: 1px solid #144372; border-radius: 3px; background: #144372; color: #fff; font-weight: 700; }
.primary-button:hover { background: #245f99; }
.broker-message { margin: .8rem 0 0; color: #725326; font-weight: 700; }
.broker-message:empty { display: none; }
.order-view { max-width: 1000px; margin: 0 auto; }
.order-marquee { position: relative; height: 42px; margin-bottom: 1rem; overflow: hidden; }
.order-marquee-text { position: absolute; inset-block: 0; left: 0; display: flex; align-items: center; width: max-content; white-space: nowrap; color: #ed1717; font-size: 1.1rem; font-weight: 400; line-height: 1; }
.order-banner { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.15rem; padding: .8rem 1rem; border: 1px solid #c7d5e3; border-left: 5px solid #144372; background: #e8f0f8; }
.order-banner > div { display: flex; flex-direction: column; line-height: 1.4; }
.order-banner strong { font-size: 1.08rem; }
.order-banner span:not(.broker-icon) { color: #55728e; font-size: .83rem; }
.order-return { display: flex; justify-content: center; margin: clamp(2.5rem, 8vh, 6rem) 0 1rem; }
.order-return .back-button { min-width: 190px; justify-content: center; margin-bottom: 0; }
.detail-hero.order-hero { padding: 1rem 1.25rem; border-top-width: 4px; }
.detail-hero.order-hero h2 { margin: 0 0 .3rem; font-size: 1.5rem; line-height: 1.3; }
.order-hero .detail-code { display: block; margin-top: .15rem; font-size: 1rem; }
.order-hero .detail-subtitle { font-size: .95rem; }
.order-guarantee { margin: 1.2rem 0 0; color: #6d7770; font-size: .78rem; line-height: 1.65; }
.order-list-back { margin-bottom: 1rem; }
.kerui-order-list { display: grid; gap: .75rem; }
.kerui-order-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; padding: 1rem 1.1rem; border: 1px solid #c7d5e3; border-radius: 3px; background: #fff; color: #153b60; text-align: left; }
.kerui-order-item:hover { border-color: #6888a7; background: #f4f8fc; }
.kerui-order-item > span:first-child { display: grid; gap: .35rem; }
.kerui-order-item strong { font-size: 1rem; }
.kerui-order-item em { margin-left: .35rem; color: #60758a; font-style: normal; font-size: .85rem; }
.kerui-order-item small { color: #60758a; }
.kerui-order-item-price { display: flex; align-items: center; gap: .75rem; white-space: nowrap; font-weight: 700; }
.kerui-order-item-price b { font-size: 1.5rem; font-weight: 400; }

.site-footer { border-top: 1px solid #c7d5e3; background: #e8f0f8; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; padding: 1.25rem 2rem; color: #526a82; font-size: .8rem; }
.back-to-top { position: fixed; z-index: 10; right: 1.25rem; bottom: 1.25rem; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 62px; height: 62px; border: 1px solid #d4c29b; border-radius: 3px; background: #144372; color: #fff; box-shadow: 0 4px 14px #102c4a40; line-height: 1.1; font-size: .78rem; font-weight: 700; }
.back-to-top span:first-child { font-size: 1.5rem; line-height: 1; }
.back-to-top:hover { background: #245f99; }

@media (max-width: 900px) {
  .search-grid { grid-template-columns: repeat(3, 1fr); }
  .search-field { grid-column: 1 / -1; }
  .column-head, .case-row { grid-template-columns: 1.2fr 1.6fr .8fr 1fr 2.5rem; }
  .column-head span:nth-child(5), .case-type { display: none; }
}

@media (max-width: 640px) {
  .kerui-order-item { align-items: flex-start; flex-direction: column; }
  .kerui-order-item-price { width: 100%; justify-content: space-between; }
  .header-inner { min-height: 80px; padding: .85rem 1rem; gap: .65rem; }
  .brand-logo { width: 54px; height: 35px; }
  .brand-logo img { top: -11.2px; left: -29.3px; width: 112.5px; }
  .brand-eyebrow { font-size: .67rem; }
  .brand-text strong { font-size: 1.13rem; }
  .header-login { min-width: 62px; padding: .3rem .5rem; font-size: .83rem; }
  .page-shell { padding: 1.35rem 1rem 3rem; }
  .page-intro { padding-bottom: 1.4rem; }
  h1 { font-size: 1.7rem; }
  .intro-note { font-size: .9rem; }
  .source-stamp { display: none; }
  .popular-links { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; }
  .popular-links::-webkit-scrollbar { display: none; width: 0; height: 0; }
  .search-panel { padding: 1rem; }
  .search-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .search-field { grid-column: 1 / -1; }
  .field input, .field select { min-height: 54px; }
  .list-heading { margin-top: 1.65rem; }
  .sort-note { display: none; }
  .column-head { display: none; }
  .case-row { min-height: 0; grid-template-columns: 1fr auto; gap: .15rem .65rem; padding: 1rem; }
  .case-name { grid-column: 1; grid-row: 1; font-size: 1.13em; }
  .row-open { grid-column: 2; grid-row: 1 / 4; align-self: center; }
  .case-code { grid-column: 1; grid-row: 2; font-size: .88rem; }
  .case-date { grid-column: 1; grid-row: 3; font-size: .92rem; }
  .market-tag { grid-column: 1; grid-row: 4; margin-top: .4rem; }
  .case-date::before { content: "開標 "; color: #637b92; font-weight: 400; }
  .detail-hero { padding: 1.25rem; }
  .detail-hero h2 { font-size: 1.75rem; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-card { padding: 1.15rem 1.2rem; }
  .detail-card dl > div { flex-direction: column; gap: .05rem; }
  .detail-card dd { text-align: left; }
  .broker-panel { padding: 1.1rem; }
  .broker-card { min-height: 72px; }
  .broker-list { max-height: min(342px, 50vh); padding-right: 0; scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; }
  .broker-list::-webkit-scrollbar { display: none; width: 0; height: 0; }
  .broker-icon { width: 48px; height: 48px; }
  .kerui-icon img { width: 120px; height: 120px; left: -38px; top: -28px; }
  .footer-inner { flex-direction: column; padding: 1.2rem 1rem; }
  .back-to-top { right: .85rem; bottom: .85rem; width: 58px; height: 58px; }
}

@media (max-width: 380px) {
  .brand-eyebrow { display: none; }
  .search-grid { grid-template-columns: 1fr; }
  .search-field { grid-column: 1; }
}
