@layer reset,base,components,responsive;
@layer reset {
  * {
    box-sizing: border-box;
  }
  body,
  h1,
  h2,
  h3,
  p {
    margin: 0;
  }
  button,
  input,
  select {
    font: inherit;
  }
  button,
  a,
  input,
  select {
    -webkit-tap-highlight-color: transparent;
  }
  button {
    cursor: pointer;
  }
  img {
    max-width: 100%;
  }
  [hidden] {
    display: none !important;
  }
}
@layer base {
  :root {
    color-scheme: light dark;
    --bg: light-dark(#f5f5ee, #141d19);
    --paper: light-dark(#fffefa, #1d2922);
    --ink: light-dark(#203d30, #edf2e8);
    --sub: light-dark(#5f7063, #b8c7b9);
    --line: light-dark(#dce2d7, #3c4e40);
    --soft: light-dark(#e9eee1, #2b3c2f);
    --accent: light-dark(#285c43, #c6e2b8);
    --on: light-dark(#fffefa, #1b3525);
    --warn: light-dark(#80601c, #e4c77f);
    --bad: light-dark(#994a34, #f0b39b);
    --shadow: 0 20px 70px #14291d1c;
    font-family:
      system-ui,
      -apple-system,
      BlinkMacSystemFont,
      'PingFang TC',
      'Noto Sans TC',
      sans-serif;
    font-size: 15px;
    line-height: 1.75;
    background: var(--bg);
    color: var(--ink);
  }
  body {
    min-width: 320px;
  }
  button,
  a,
  select {
    touch-action: manipulation;
  }
  button {
    color: inherit;
  }
  a {
    color: var(--accent);
    text-underline-offset: 4px;
  }
  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  summary:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
  }
  button:disabled {
    opacity: 0.55;
    cursor: wait;
  }
  h1,
  h2,
  h3 {
    line-height: 1.4;
    font-weight: 650;
    letter-spacing: -0.025em;
  }
  p + p {
    margin-top: 14px;
  }
  input,
  select {
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
    min-height: 46px;
    padding: 10px 12px;
  }
  input[type='checkbox'] {
    min-height: 20px;
    min-width: 20px;
    accent-color: var(--accent);
  }
  .shell {
    max-width: 1240px;
    margin: auto;
    padding: 0 44px;
  }
  .skip {
    position: absolute;
    top: 8px;
    left: 8px;
    transform: translateY(-200%);
    z-index: 50;
    background: var(--paper);
    padding: 10px;
  }
  .skip:focus {
    transform: none;
  }
  .muted,
  .fine {
    color: var(--sub);
  }
  .fine {
    font-size: 12px;
    line-height: 1.8;
  }
  .eyebrow {
    font-size: 11px;
    letter-spacing: 0.13em;
    font-weight: 650;
    color: var(--sub);
  }
  .loading {
    padding: 100px 0;
  }
  .loading h1 {
    font-size: 28px;
    margin: 20px 0 10px;
  }
  .loading-dot {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
  }
}
@layer components {
  .topbar {
    min-height: 110px;
    display: flex;
    align-items: center;
    gap: 36px;
    border-bottom: 1px solid var(--line);
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 18px;
    white-space: nowrap;
  }
  .brand small {
    display: block;
    font-size: 9px;
    letter-spacing: 0.13em;
    font-weight: 550;
    color: var(--sub);
    margin-top: 1px;
  }
  .topbar nav {
    display: flex;
    gap: 26px;
    margin: auto;
  }
  .topbar nav a {
    text-decoration: none;
    color: var(--sub);
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
  }
  .topbar nav a[aria-current='page'] {
    color: var(--ink);
    border-bottom-color: var(--accent);
    font-weight: 650;
  }
  .topbar nav span {
    font-size: 11px;
    background: var(--soft);
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
  }
  .profile-open,
  .quiet-button {
    border: 1px solid var(--line);
    background: transparent;
    padding: 10px 15px;
    border-radius: 10px;
    min-height: 44px;
    font-size: 13px;
  }
  .profile-open:hover,
  .quiet-button:hover {
    background: var(--soft);
  }
  .hero {
    padding: 44px 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 30px;
  }
  .hero h1 {
    text-wrap: balance;
    font-size: clamp(29px, 3vw, 40px);
    margin: 7px 0 12px;
    letter-spacing: -0.045em;
  }
  .hero p {
    color: var(--sub);
    max-width: 660px;
    font-size: 14px;
  }
  .hero-side {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    color: var(--sub);
    flex: none;
  }
  .signal {
    height: 7px;
    width: 7px;
    background: var(--accent);
    border-radius: 50%;
  }
  .profile-summary {
    padding: 15px 18px;
    background: var(--soft);
    border-radius: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 25px;
    font-size: 13px;
  }
  .profile-summary button {
    background: none;
    border: 0;
    text-decoration: underline;
    text-underline-offset: 4px;
    white-space: nowrap;
    min-height: 32px;
  }
  .roles {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
  }
  .role-button {
    padding: 10px 17px;
    border-radius: 24px;
    background: var(--paper);
    border: 1px solid var(--line);
    min-height: 44px;
    font-size: 13px;
  }
  .role-button[aria-pressed='true'] {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on);
  }
  .role-button:hover {
    box-shadow: inset 0 0 0 1px var(--accent);
  }
  .filters {
    display: grid;
    grid-template-columns: minmax(210px, 1fr) 170px 170px;
    gap: 10px;
    margin: 18px 0 14px;
  }
  .search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 13px;
  }
  .search svg {
    width: 18px;
    color: var(--sub);
    flex: none;
  }
  .search input {
    border: 0;
    background: transparent;
    padding-left: 0;
    width: 100%;
    min-width: 0;
  }
  .filters label span {
    display: block;
    font-size: 11px;
    color: var(--sub);
    margin-bottom: 4px;
  }
  .filters select {
    width: 100%;
    font-size: 13px;
  }
  .filters .search {
    align-self: end;
  }
  .result-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    color: var(--sub);
    margin: 20px 0 15px;
  }
  .toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
  }
  .toggle-label input {
    width: 16px;
    height: 16px;
    min-height: 16px;
    min-width: 16px;
  }
  .cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
  .op-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 23px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition:
      border-color 160ms,
      transform 160ms;
  }
  .op-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
  }
  .card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  .tag {
    font-size: 11px;
    letter-spacing: 0.04em;
    padding: 4px 9px;
    border-radius: 5px;
    background: var(--soft);
    color: var(--accent);
  }
  .save-button,
  .icon-button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 9px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    flex: none;
  }
  .save-button:hover,
  .icon-button:hover {
    background: var(--soft);
  }
  .save-button[aria-pressed='true'] {
    background: var(--soft);
    color: var(--accent);
  }
  .save-button svg {
    height: 19px;
    width: 19px;
  }
  .op-card h2 {
    font-size: 21px;
    margin: 12px 0 6px;
  }
  .round {
    font-size: 11px;
    color: var(--sub);
    margin-bottom: 12px;
  }
  .op-card .summary {
    font-size: 13px;
    color: var(--sub);
    line-height: 1.8;
    min-height: 47px;
  }
  .benefit {
    font-size: 12px;
    color: var(--ink);
    margin-top: 16px;
  }
  .card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: 15px 0 5px;
    font-size: 12px;
    color: var(--sub);
  }
  .match-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--accent);
  }
  .match-label.unknown,
  .match-label.review {
    color: var(--warn);
  }
  .match-label.ineligible {
    color: var(--bad);
  }
  .card-bottom {
    margin-top: auto;
    padding-top: 19px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: end;
  }
  .deadline-text {
    font-size: 12px;
    color: var(--sub);
  }
  .deadline-text strong {
    display: block;
    font-size: 15px;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.55;
  }
  .deadline-text.soon strong {
    color: var(--warn);
  }
  .text-action {
    background: none;
    border: 0;
    padding: 9px 0;
    min-height: 44px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: 5px;
    white-space: nowrap;
  }
  .card-source {
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 11px;
    color: var(--sub);
    display: flex;
    justify-content: space-between;
    gap: 10px;
  }
  .mini-progress {
    height: 4px;
    border-radius: 4px;
    background: var(--soft);
    overflow: hidden;
    margin-top: 16px;
  }
  .mini-progress span {
    display: block;
    height: 100%;
    background: var(--accent);
  }
  .empty {
    grid-column: 1/-1;
    border: 1px dashed var(--line);
    border-radius: 18px;
    padding: 50px 24px;
    text-align: center;
  }
  .empty h2 {
    font-size: 23px;
    margin-bottom: 12px;
  }
  .empty p {
    color: var(--sub);
    font-size: 14px;
    max-width: 500px;
    margin: 0 auto 20px;
  }
  .notice {
    padding: 13px 16px;
    border-radius: 10px;
    background: var(--soft);
    font-size: 13px;
    margin: 12px 0 20px;
    color: var(--sub);
  }
  .notice.warning {
    border-left: 3px solid var(--warn);
  }
  .timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 26px;
  }
  .timeline button {
    display: flex;
    gap: 14px;
    align-items: center;
    flex: 1;
    min-width: 220px;
    text-align: left;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--paper);
    font-size: 12px;
  }
  .timeline time {
    font-size: 16px;
    white-space: nowrap;
    color: var(--accent);
  }
  dialog {
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 0;
    box-shadow: var(--shadow);
    max-height: calc(100dvh - 48px);
    overscroll-behavior: contain;
  }
  dialog::backdrop {
    background: #10271d70;
    backdrop-filter: blur(5px);
  }
  .detail-dialog {
    width: min(880px, calc(100vw - 48px));
  }
  .detail-header {
    padding: 25px 30px 22px;
    border-bottom: 1px solid var(--line);
  }
  .dialog-top {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 8px;
  }
  .detail-header h2 {
    font-size: 28px;
    margin: 8px 0;
  }
  .detail-header p {
    color: var(--sub);
    font-size: 14px;
    max-width: 680px;
  }
  .detail-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 0.8fr);
    gap: 30px;
    padding: 28px 30px;
  }
  .detail-body h3 {
    font-size: 15px;
    margin: 0 0 12px;
  }
  .detail-body section + section {
    margin-top: 24px;
  }
  .deadline-box {
    padding: 16px 18px;
    border-radius: 12px;
    background: var(--soft);
    margin-bottom: 20px;
  }
  .deadline-box small {
    display: block;
    font-size: 12px;
    color: var(--sub);
  }
  .deadline-box strong {
    display: block;
    font-size: 21px;
    margin: 4px 0;
    font-variant-numeric: tabular-nums;
  }
  .checks {
    list-style: none;
    padding: 0;
    margin: 14px 0;
  }
  .checks li {
    display: flex;
    gap: 9px;
    margin: 14px 0;
    font-size: 13px;
  }
  .rule-mark {
    font-size: 15px;
    color: var(--warn);
    flex: none;
  }
  .rule-mark.pass {
    color: var(--accent);
  }
  .rule-mark.fail {
    color: var(--bad);
  }
  .rule-answer {
    display: block;
    width: 100%;
    margin-top: 8px;
    min-height: 42px;
    font-size: 12px;
    padding: 8px;
  }
  .source-evidence {
    border-top: 1px solid var(--line);
    padding-top: 14px;
    margin-top: 20px;
    font-size: 12px;
    line-height: 1.8;
  }
  .source-evidence summary {
    cursor: pointer;
    min-height: 38px;
    font-weight: 650;
  }
  .evidence-row {
    margin: 12px 0;
    padding-left: 12px;
    border-left: 2px solid var(--line);
  }
  .evidence-row q {
    display: block;
    color: var(--ink);
  }
  .primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--accent);
    color: var(--on);
    border: 1px solid var(--accent);
    border-radius: 10px;
    min-height: 46px;
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
  }
  .official-link {
    width: 100%;
    margin-top: 16px;
    justify-content: space-between;
  }
  .step-list {
    display: grid;
    gap: 0;
  }
  .step-list label {
    display: flex;
    align-items: start;
    gap: 10px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    cursor: pointer;
    min-height: 46px;
  }
  .step-list input {
    margin-top: 3px;
    flex: none;
  }
  .step-list label:has(input:checked) span {
    color: var(--sub);
  }
  .progress-caption {
    font-size: 12px;
    color: var(--sub);
    display: flex;
    justify-content: space-between;
    gap: 10px;
  }
  .next-step {
    font-size: 13px;
    margin: 18px 0;
    color: var(--accent);
  }
  .workflow {
    display: block;
    font-size: 12px;
    color: var(--sub);
    margin: 16px 0;
  }
  .workflow select {
    width: 100%;
    margin-top: 6px;
  }
  .detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
  }
  .detail-actions button {
    flex: 1;
  }
  .profile-dialog {
    width: min(490px, calc(100vw - 36px));
    padding: 26px;
  }
  .profile-dialog h2 {
    font-size: 24px;
    margin-bottom: 12px;
  }
  .profile-dialog p {
    font-size: 13px;
    line-height: 1.85;
  }
  .profile-dialog fieldset {
    border: 0;
    padding: 0;
    margin: 25px 0 15px;
  }
  .profile-dialog legend {
    font-size: 12px;
    color: var(--sub);
    margin-bottom: 10px;
  }
  .profile-dialog fieldset label {
    display: flex;
    gap: 10px;
    align-items: center;
    min-height: 44px;
    font-size: 14px;
  }
  .field {
    display: block;
    font-size: 12px;
    margin: 16px 0;
  }
  .field select {
    display: block;
    width: 100%;
    margin-top: 6px;
  }
  .dialog-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 25px;
  }
  .danger-button {
    border: 1px solid var(--bad);
    color: var(--bad);
    background: transparent;
    border-radius: 10px;
    padding: 12px;
    font-size: 13px;
    margin: 22px 0;
    min-height: 44px;
  }
  .source-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
  }
  .source-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    background: var(--paper);
    font-size: 13px;
  }
  .source-card h2 {
    font-size: 17px;
    margin-bottom: 10px;
  }
  .source-card dl {
    display: grid;
    grid-template-columns: 95px minmax(0, 1fr);
    gap: 6px;
    font-size: 12px;
    margin: 14px 0;
  }
  .source-card dt {
    color: var(--sub);
  }
  .source-card dd {
    margin: 0;
    overflow-wrap: anywhere;
  }
  .source-card .error {
    color: var(--bad);
    margin: 12px 0;
  }
  .section-title {
    font-size: 20px;
    margin: 32px 0 16px;
  }
  .source-tools {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin: 20px 0;
  }
  .footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 14px;
    border-top: 1px solid var(--line);
    margin-top: 50px;
    padding: 24px 0 36px;
    font-size: 11px;
    color: var(--sub);
  }
  .footer button {
    border: 0;
    background: none;
    font-size: 11px;
    padding: 4px 0;
    min-height: 44px;
    margin-right: 16px;
    text-decoration: underline;
  }
  .toast {
    position: fixed;
    bottom: max(25px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--on);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    font-size: 13px;
    z-index: 100;
    max-width: calc(100vw - 30px);
    text-align: center;
    pointer-events: none;
  }
}
@layer responsive {
  @media (max-width: 900px) {
    .shell {
      padding: 0 25px;
    }
    .topbar {
      gap: 15px;
    }
    .topbar nav {
      gap: 17px;
    }
    .brand small {
      font-size: 8px;
    }
    .brand {
      font-size: 16px;
    }
    .profile-open {
      padding: 8px 10px;
    }
    .hero-side {
      display: none;
    }
    .op-card {
      padding: 20px;
    }
    .op-card h2 {
      font-size: 19px;
    }
  }
  @media (max-width: 650px) {
    .shell {
      padding: 0 18px;
    }
    .topbar {
      padding-top: 22px;
      min-height: 126px;
      flex-wrap: wrap;
      justify-content: space-between;
      gap: 14px;
    }
    .brand {
      font-size: 17px;
    }
    .brand img {
      width: 33px;
      height: 33px;
    }
    .topbar nav {
      order: 3;
      width: 100%;
      margin: 0;
      justify-content: space-between;
      gap: 10px;
    }
    .topbar nav a {
      font-size: 13px;
      min-height: 42px;
    }
    .profile-open {
      font-size: 12px;
    }
    .hero {
      padding: 30px 0 23px;
    }
    .hero h1 {
      font-size: 30px;
      max-width: 350px;
    }
    .hero p {
      font-size: 13px;
    }
    .profile-summary {
      padding: 12px 14px;
      font-size: 12px;
      align-items: start;
      gap: 12px;
      margin-bottom: 20px;
    }
    .profile-summary button {
      font-size: 12px;
    }
    .roles {
      gap: 6px;
    }
    .role-button {
      padding: 9px 13px;
      font-size: 12px;
    }
    .filters {
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-top: 17px;
    }
    .filters .search {
      grid-column: 1/-1;
    }
    .filters input,
    .filters select,
    .field select,
    .workflow select,
    .rule-answer {
      font-size: 16px;
    }
    .cards,
    .source-grid {
      grid-template-columns: 1fr;
    }
    .op-card {
      padding: 20px;
      border-radius: 16px;
    }
    .op-card h2 {
      font-size: 21px;
    }
    .op-card .summary {
      min-height: 0;
    }
    .card-bottom {
      padding-top: 15px;
    }
    .result-bar {
      margin: 16px 0 12px;
    }
    .detail-dialog {
      width: 100%;
      max-width: 100%;
      height: 100dvh;
      max-height: 100dvh;
      margin: 0;
      border: 0;
      border-radius: 0;
    }
    .detail-header {
      padding: 18px 22px 22px;
    }
    .detail-header h2 {
      font-size: 25px;
    }
    .detail-body {
      grid-template-columns: 1fr;
      padding: 23px 22px;
      gap: 25px;
      padding-bottom: max(35px, env(safe-area-inset-bottom));
    }
    .detail-side {
      border-top: 1px solid var(--line);
      padding-top: 25px;
    }
    .profile-dialog {
      padding: 22px;
    }
    .profile-dialog h2 {
      font-size: 23px;
    }
    .footer {
      margin-top: 35px;
      display: block;
    }
    .footer > span {
      display: block;
      margin: 6px 0;
    }
    .source-card {
      padding: 18px;
    }
    .dialog-actions {
      flex-wrap: wrap;
    }
    .source-tools {
      font-size: 12px;
    }
    .empty {
      padding: 40px 20px;
    }
  }
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      transition: none !important;
      scroll-behavior: auto !important;
    }
  }
}
