:root {
  --green-950: #09251a;
  --green-900: #0e3828;
  --green-700: #176844;
  --green-500: #20a35d;
  --paper: #fbfaf3;
  --cream: #f1eddd;
  --gold: #d2b36c;
  --ink: #13271c;
  --muted: #647268;
  --line: rgba(19, 39, 28, 0.13);
  --danger: #a54539;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0, rgba(32, 163, 93, 0.12), transparent 30%),
    linear-gradient(180deg, #faf9f1, var(--cream));
  font-family: system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
}
a { color: inherit; }
.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 56px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 44px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 64px; height: 64px; object-fit: contain; }
.brand span { font-weight: 760; line-height: 1.2; }
.brand small { display: block; margin-top: 5px; color: var(--muted); font-weight: 500; }
.topbar nav { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.button {
  display: inline-flex; min-height: 42px; align-items: center; justify-content: center;
  padding: 0 16px; border: 1px solid var(--line); border-radius: 10px;
  background: white; text-decoration: none; font-weight: 680;
}
.button.primary { border-color: transparent; color: white; background: var(--green-900); }
.eyebrow { margin: 0 0 12px; color: var(--green-700); font-size: 0.76rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1 { max-width: 760px; margin: 0; font-size: clamp(2.15rem, 6vw, 4.5rem); line-height: .98; letter-spacing: -.055em; }
.lead { max-width: 700px; margin: 20px 0 0; color: var(--muted); font-size: 1.05rem; line-height: 1.75; }
.hero { margin-bottom: 34px; }
.hero-grid { display: grid; grid-template-columns: 1.5fr .8fr; gap: 16px; align-items: stretch; }
.card {
  overflow: hidden; border: 1px solid var(--line); border-radius: 18px;
  background: rgba(255,255,255,.78); box-shadow: 0 20px 50px rgba(9,37,26,.08);
}
.card-body { padding: clamp(22px, 4vw, 36px); }
.metric { color: var(--green-900); font-size: clamp(3.5rem, 9vw, 7rem); font-weight: 850; letter-spacing: -.075em; line-height: .9; }
.metric-label { margin-top: 12px; color: var(--muted); font-weight: 680; }
.progress-track { height: 13px; overflow: hidden; margin: 28px 0 10px; border-radius: 999px; background: #e1e4d8; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green-500), var(--gold)); transition: width .7s ease; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .86rem; }
.status { display: inline-flex; align-items: center; gap: 7px; margin-top: 18px; color: var(--muted); font-size: .82rem; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green-500); }
.status.snapshot::before, .status.stale::before { background: var(--gold); }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 42px 0 14px; }
.section-title h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.025em; }
.section-title p { margin: 0; color: var(--muted); font-size: .87rem; }
.breakdown { display: grid; gap: 15px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr 42px; gap: 12px; align-items: center; }
.bar-label { color: var(--muted); font-size: .88rem; }
.bar { height: 9px; overflow: hidden; border-radius: 999px; background: #e6e7dc; }
.bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green-700); }
.bar-count { text-align: right; font-weight: 800; }
.notice { margin-top: 16px; padding: 12px 14px; border: 1px solid rgba(165,69,57,.2); border-radius: 10px; color: var(--danger); background: rgba(255,248,244,.9); font-size: .85rem; }
.hidden { display: none !important; }
.skeleton { min-height: 280px; animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: .88rem; }
th { color: var(--muted); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; }
.error { padding: 18px; border: 1px solid rgba(165,69,57,.25); border-radius: 12px; color: var(--danger); background: #fff8f4; }
.footer { margin-top: 50px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.status-filter { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .86rem; }
.status-filter select, .review-actions select {
  min-height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 0 34px 0 11px;
  color: var(--ink); background: white; font: inherit;
}
.application-table-card { overflow: visible; }
.table-scroll { overflow-x: auto; padding: 8px 18px 16px; }
.application-table-card td strong, .application-table-card td small { display: block; }
.application-table-card td small { margin-top: 4px; color: var(--muted); }
.status-badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: .76rem; font-weight: 780; white-space: nowrap; }
.status-submitted { color: #765d1d; background: #f7edcf; }
.status-reviewing { color: #245481; background: #e5eff8; }
.status-approved { color: #17613d; background: #e2f2e8; }
.status-rejected { color: #8e3d35; background: #f8e6e2; }
.row-action { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; color: var(--green-900); background: white; font: inherit; font-weight: 750; cursor: pointer; }
.empty-state { padding: 36px; color: var(--muted); text-align: center; }
.application-dialog { width: min(760px, calc(100% - 24px)); max-height: calc(100vh - 30px); border: 0; border-radius: 18px; padding: 0; color: var(--ink); background: white; box-shadow: 0 34px 90px rgba(9,37,26,.35); }
.application-dialog::backdrop { background: rgba(5,24,16,.62); backdrop-filter: blur(3px); }
.dialog-shell { padding: clamp(20px, 4vw, 34px); }
.dialog-shell > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.dialog-shell h2 { margin: 0; font-size: 1.65rem; }
.dialog-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: white; font-size: 1.5rem; cursor: pointer; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.detail-grid > div { min-width: 0; padding: 12px 14px; background: #fbfaf5; }
.detail-grid dt { color: var(--muted); font-size: .74rem; font-weight: 750; }
.detail-grid dd { margin: 5px 0 0; line-height: 1.55; overflow-wrap: anywhere; }
.review-actions { display: flex; align-items: end; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.review-actions label { display: grid; gap: 6px; color: var(--muted); font-size: .8rem; }
.status-page { max-width: 920px; }
.status-main { display: grid; gap: 18px; }
.status-hero { margin-bottom: 8px; }
.status-hero h1 { max-width: 820px; }
.lookup-card { padding: clamp(22px, 4vw, 34px); }
.lookup-tabs { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 5px; margin-bottom: 18px; padding: 5px; border-radius: 12px; background: #e9e6da; }
.lookup-tabs button { min-height: 40px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font: inherit; font-size: .84rem; font-weight: 760; cursor: pointer; }
.lookup-tabs button.is-active { color: var(--green-900); background: white; box-shadow: 0 3px 10px rgba(9,37,26,.08); }
.lookup-tabs button:focus-visible { outline: 3px solid rgba(23,104,68,.18); outline-offset: 1px; }
.lookup-form {
  display: grid; grid-template-columns: minmax(0,1fr) auto;
  gap: 14px; align-items: end;
}
.lookup-form label { display: grid; gap: 8px; color: var(--ink); font-size: .84rem; font-weight: 760; }
.lookup-form input {
  width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px;
  color: var(--ink); background: #fbfaf4; font: inherit; outline: none;
}
.lookup-form input:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(23,104,68,.11); }
.lookup-form .button { min-height: 46px; border: 0; cursor: pointer; font: inherit; }
.form-message { margin-top: 14px; padding: 12px 14px; border: 1px solid rgba(165,69,57,.22); border-radius: 10px; color: var(--danger); background: #fff8f4; font-size: .86rem; }
.status-result { border-color: rgba(210,179,108,.38); background: rgba(255,253,246,.96); }
.status-result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.status-result-head h2 { margin: 0; font-size: clamp(1.8rem, 5vw, 2.7rem); letter-spacing: -.04em; }
.status-result-head .status-badge { margin-top: 2px; }
.status-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 30px 0; padding: 0; list-style: none; }
.status-steps li { position: relative; display: grid; justify-items: center; gap: 10px; padding: 0 14px; color: #9ca49e; text-align: center; }
.status-steps li:not(:last-child)::after { content: ""; position: absolute; z-index: 0; top: 18px; left: calc(50% + 22px); width: calc(100% - 44px); height: 2px; background: #dde1da; }
.status-steps li > span { position: relative; z-index: 1; display: grid; width: 38px; height: 38px; place-items: center; border: 2px solid #d8ddd8; border-radius: 50%; background: #fffdf6; font-weight: 850; }
.status-steps li div { display: grid; gap: 5px; }
.status-steps li strong { color: inherit; font-size: .92rem; }
.status-steps li small { color: inherit; font-size: .76rem; line-height: 1.45; }
.status-steps li.is-complete { color: var(--green-700); }
.status-steps li.is-complete > span { border-color: var(--green-700); color: white; background: var(--green-700); }
.status-steps li.is-complete:not(:last-child)::after { background: var(--green-700); }
.status-steps li.is-rejected { color: var(--danger); }
.status-steps li.is-rejected > span { border-color: var(--danger); background: var(--danger); }
.status-meta { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1px; overflow: hidden; margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.status-meta > div { min-width: 0; padding: 13px 15px; background: #fbfaf5; }
.status-meta dt { color: var(--muted); font-size: .74rem; font-weight: 740; }
.status-meta dd { margin: 5px 0 0; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .shell { width: min(100% - 22px, 1120px); padding-top: 14px; }
  .topbar { align-items: flex-start; margin-bottom: 34px; }
  .brand span { display: none; }
  .brand img { width: 58px; height: 58px; }
  .hero-grid, .stats-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr 44px; }
  .bar { grid-column: 1 / -1; grid-row: 2; }
  h1 { font-size: clamp(2.4rem, 14vw, 4rem); }
  .application-list-title { align-items: flex-start; flex-direction: column; }
  .detail-grid { grid-template-columns: 1fr; }
  .review-actions { align-items: stretch; flex-direction: column; }
  .review-actions .button { width: 100%; }
  .lookup-form { grid-template-columns: 1fr; }
  .lookup-tabs button { padding: 0 5px; font-size: .76rem; }
  .status-steps { grid-template-columns: 1fr; gap: 18px; }
  .status-steps li { grid-template-columns: 38px 1fr; justify-items: start; padding: 0; text-align: left; }
  .status-steps li:not(:last-child)::after { top: 38px; left: 18px; width: 2px; height: 18px; }
  .status-steps li div { align-self: center; }
  .status-meta { grid-template-columns: 1fr; }
}
