/* 循環衣流・資源循環署儀表板 demo（靜態版，數字皆為寫死的示意資料） */
:root {
  --bg: #e6f0ec;
  --ink: #12301f;
  --muted: #6a706b;
  --lime: #c9e86b;
  --lime-d: #7fa524;
  --sky: #a9cfe0;
  --navy: #2f4e5e;
  --navy-m: #3f6475;
  --teal: #25aea1;
  --blue: #3a8bea;
  --purple: #6340c9;
  --soft: #f4f6f3;
  --mint: #e4f1c9;
  --line: #e5e7e2;
  --mint-ink: #b9d9c4;
  --radius: 28px;
  --rail: 84px;
  --gap: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Noto Sans TC", system-ui, -apple-system, "PingFang TC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.3;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.num { font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.unit { font-weight: 500; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.app { display: flex; min-height: 100vh; }
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--rail);
  background: #fff; display: flex; flex-direction: column; align-items: center;
  padding: 22px 0 20px; gap: 14px; z-index: 20;
}
.rail .logo { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; margin-bottom: 18px; }
.rail .logo img { width: 100%; height: 100%; display: block; }
.rail nav { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.rail .divider { width: 28px; height: 1px; background: var(--line); margin: 4px 0; }
.nav-btn {
  width: 48px; height: 48px; border-radius: 999px; display: grid; place-items: center;
  color: var(--ink); transition: background .15s;
}
.nav-btn:hover { background: var(--soft); }
.nav-btn[aria-current="page"] { background: var(--lime); }
.nav-btn.is-disabled { opacity: .35; cursor: not-allowed; }
.nav-btn.is-disabled:hover { background: none; }
.rail .spacer { flex: 1; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; background: #e3efe8; border: 2px solid var(--lime);
  display: grid; place-items: center; font-weight: 700; font-size: 16px; color: var(--ink);
}
.nav-label { display: none; }

.main { flex: 1; margin-left: var(--rail); padding: 26px 28px 28px 24px; min-width: 0; }

/* ---------- header ---------- */
.header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.header h1 { margin: 0; font-size: 28px; font-weight: 700; }
.header p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.search {
  display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 999px;
  padding: 0 22px 0 18px; height: 47px; width: 270px; color: var(--muted);
}
.search .icon { width: 18px; height: 18px; }
.search input { border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; width: 100%; color: var(--ink); }
.search input::placeholder { color: #8e948f; }

.header .mobile-logo { display: none; width: 40px; height: 40px; border-radius: 50%; }
.header .titles { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(115deg, #12301f 0%, #1e7a4c 100%);
  color: #fff; border-radius: var(--radius); padding: 30px 36px 26px; margin-bottom: var(--gap);
  display: flex; flex-direction: column; gap: 26px; overflow: hidden;
}
.hero .eyebrow { font-size: 14px; font-weight: 500; color: var(--mint-ink); }
.hero h2 { margin: 6px 0 0; font-size: 26px; font-weight: 700; }
.flow { display: flex; align-items: center; gap: 16px; }
.flow-item { flex: 1; display: flex; align-items: center; gap: 14px; min-width: 0; }
.flow-icon { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; flex: none; background: rgba(255,255,255,.12); }
.flow-icon .icon { width: 30px; height: 30px; stroke-width: 2.2; }
.flow-item.hi .flow-icon { background: var(--lime); color: var(--ink); }
.flow-value { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.flow-value .num { font-size: clamp(36px, 3.4vw, 50px); line-height: 1.1; }
.flow-value .unit { font-size: 18px; color: var(--mint-ink); }
.flow-item.hi .flow-value .num, .flow-item.hi .flow-value .unit { color: var(--lime); }
.flow-label { font-size: 15px; font-weight: 500; margin-top: 2px; }
.flow-arrow { color: var(--mint-ink); flex: none; }
.flow-arrow .icon { width: 28px; height: 28px; }

.progress {
  display: flex; align-items: center; gap: 16px; background: rgba(255,255,255,.10);
  border-radius: 999px; padding: 8px 8px 8px 18px;
}
.progress .label { font-size: 13px; font-weight: 700; white-space: nowrap; }
.bar { flex: 1; height: 8px; border-radius: 4px; background: rgba(255,255,255,.18); overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--lime); border-radius: 4px; }
.progress .stat { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.progress .stat small { font-size: 13px; font-weight: 500; color: var(--mint-ink); }
.progress .stat b { font-size: 18px; }
.btn-dark {
  display: inline-flex; align-items: center; gap: 12px; background: var(--ink); color: #fff;
  border-radius: 999px; padding: 8px 8px 8px 22px; font-weight: 700; font-size: 16px; white-space: nowrap;
}
.btn-dark .circle { width: 38px; height: 38px; border-radius: 50%; background: #fff; color: var(--ink); display: grid; place-items: center; }
.btn-dark .circle .icon { width: 18px; height: 18px; }
.btn-dark:hover { background: #0b2216; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.card { border-radius: var(--radius); padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 12px; }
.card-head h3 { margin: 0; font-size: 20px; font-weight: 700; flex: 1; }
.card-head .aside { font-size: 12px; }
.icon-box { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.icon-box .icon { width: 22px; height: 22px; stroke-width: 2.2; }

.card.input { background: #fff; }
.card.input .icon-box { background: #f1f4f1; border-radius: 14px; }
.big { display: flex; align-items: baseline; gap: 8px; }
.big .num { font-size: 52px; line-height: 1.05; }
.big .unit { font-size: 18px; color: var(--muted); font-weight: 400; }
.ratio-labels { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 6px; }
.ratio-wrap { flex: 1; display: flex; flex-direction: column; min-height: 90px; }
.ratio { display: flex; gap: 0; flex: 1; min-height: 65px; max-height: 160px; }
.ratio > span {
  display: block; height: 100%;
  background: repeating-linear-gradient(90deg, var(--c) 0 6px, transparent 6px 10.5px);
}
.ratio .uniform { --c: var(--teal); }
.ratio .consumer { --c: var(--blue); }
.split { display: flex; justify-content: space-between; margin-top: auto; }
.split .item .v { display: flex; align-items: baseline; gap: 4px; }
.split .item .v .num { font-size: 22px; font-weight: 500; }
.split .item .v .unit { font-size: 11px; color: var(--muted); font-weight: 400; }
.split .item .k { font-size: 12px; font-weight: 500; }
.split .item:last-child { text-align: right; }
.split .item:last-child .v { justify-content: flex-end; }

.card.output { background: var(--sky); color: var(--navy); container-type: inline-size; }
.card.output .icon-box { background: rgba(255,255,255,.7); }
.card.output .card-head .aside { color: var(--navy-m); }
.output-body { display: flex; gap: 18px; flex: 1; min-height: 0; }
.output-stats { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 12px; min-width: 0; }
.output-stats .k { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; }
.output-stats .k .icon { width: 18px; height: 18px; }
.output-stats .v { display: flex; align-items: baseline; gap: 6px; color: var(--ink); white-space: nowrap; }
.output-stats .v .num { font-size: 46px; line-height: 1.1; }
.output-stats .v .unit { font-size: 16px; color: var(--navy-m); }
.output-stats hr { border: 0; height: 1px; background: rgba(255,255,255,.6); margin: 4px 0; width: 100%; }
.shirts {
  background: rgba(255,255,255,.55); border-radius: 16px; padding: 14px 12px;
  display: grid; grid-template-columns: repeat(5, 24px); gap: 7px 8px; align-content: center; justify-content: center;
}
.shirts .icon { width: 24px; height: 24px; color: var(--navy); }
.shirts .icon.faint { opacity: .3; }
.card-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--navy-m); }

.card.benefit { background: var(--mint); }
.card.benefit .card-head .icon-box { background: #fff; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; }
.tile { background: rgba(255,255,255,.75); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; }
.tile .icon-box { width: 36px; height: 36px; border-radius: 10px; background: var(--mint); }
.tile .icon-box .icon { width: 20px; height: 20px; }
.tile .k { font-size: 15px; font-weight: 700; }
.tile .v { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.tile .v .num { font-size: 40px; line-height: 1.1; }
.tile .v .unit { font-size: 16px; color: var(--muted); }
.tile .note { font-size: 11px; color: var(--muted); }
.wan { font-size: 50px; } /* 萬／億 一律 50 */

/* ---------- batch list page ---------- */
.panel { background: #fff; border-radius: var(--radius); padding: 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.panel-head h2 { margin: 0; font-size: 20px; }
.panel-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.select {
  appearance: none; border: 1px solid #d9ddd6; border-radius: 10px; background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2312301F' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--ink); padding: 8px 34px 8px 14px; cursor: pointer;
}
.batch { margin-bottom: 14px; }
.batch-row {
  width: 100%; display: flex; align-items: center; gap: 20px; text-align: left; cursor: pointer;
  border-radius: 24px; padding: 18px; border: 1px solid transparent; background: var(--soft);
}
.batch.is-current .batch-row { background: #eef5f8; border-color: var(--sky); }
.batch-icon { width: 56px; height: 56px; border-radius: 16px; background: #fff; display: grid; place-items: center; flex: none; }
.batch-main { flex: 1; min-width: 0; }
.batch-name { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; }
.tag { font-size: 12px; font-weight: 700; color: #1e7a4c; background: rgba(43,176,116,.16); border-radius: 999px; padding: 2px 9px; }
.batch-sub { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.batch-sub .icon { width: 13px; height: 13px; }
.batch-weight { text-align: right; }
.batch-weight .v { display: flex; align-items: baseline; justify-content: flex-end; gap: 4px; }
.batch-weight .num { font-size: 34px; line-height: 1.1; }
.batch-weight .unit { font-size: 12px; color: var(--muted); font-weight: 400; }
.batch-weight .dest { font-size: 12px; font-weight: 500; color: var(--purple); }
.chev {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: #fff; color: var(--ink); transition: transform .2s;
}
.batch.is-current .chev { background: var(--ink); color: var(--lime); }
.batch[aria-expanded="true"] .chev { transform: rotate(90deg); }
.items { display: none; padding: 12px 0 0 38px; }
.batch[aria-expanded="true"] .items { display: grid; gap: 10px; }
.item-row {
  display: grid; grid-template-columns: 90px 110px 1fr 90px 120px 120px; align-items: center; gap: 12px;
  background: var(--soft); border-radius: 16px; padding: 13px 18px; font-size: 14px;
}
.item-row .date { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.item-row .date .icon { width: 13px; height: 13px; }
.item-row .id { font-weight: 700; }
.item-row .state { text-align: right; font-size: 13px; color: var(--muted); }
.item-row .w { font-variant-numeric: tabular-nums; }
.item-row .src { display: none; }
.empty-note { background: var(--soft); border-radius: 16px; padding: 14px 18px; font-size: 14px; color: var(--muted); }
.demo-note { margin: 18px 4px 0; font-size: 12px; color: var(--muted); }

/* ---------- iPad / small laptop ---------- */
@media (max-width: 1599px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card.benefit { grid-column: 1 / -1; }
  .flow-value .num { font-size: 40px; }
}
@media (max-width: 960px) {
  .main { padding: 22px 18px 24px 18px; }
  .header .search { width: 240px; }
  .hero { padding: 26px 24px 22px; }
  .flow { flex-direction: column; align-items: stretch; gap: 10px; }
  .flow-arrow { transform: rotate(90deg); align-self: flex-start; margin-left: 15px; }
  .progress { flex-wrap: wrap; border-radius: 22px; padding: 14px 16px; }
  .progress .bar { flex-basis: 100%; order: 3; }
  .progress .btn-dark { margin-left: auto; }
  .item-row { grid-template-columns: 110px 1fr 80px 110px 110px; }
  .item-row .date { display: none; }
  .items { padding-left: 0; }
}

/* ---------- phone ---------- */
@media (max-width: 720px) {
  :root { --radius: 22px; --gap: 12px; }
  .rail {
    inset: auto 0 0 0; width: 100%; height: 76px; flex-direction: row; justify-content: space-around;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); gap: 0; height: auto;
  }
  .rail .logo, .rail .divider, .rail .spacer, .rail .avatar, .rail .logout { display: none; }
  .rail nav { flex-direction: row; justify-content: space-around; width: 100%; gap: 0; }
  .nav-btn { width: auto; height: auto; flex-direction: column; gap: 3px; display: flex; align-items: center; border-radius: 0; }
  .nav-btn:hover, .nav-btn[aria-current="page"] { background: none; }
  .nav-btn .pill { padding: 4px 16px; border-radius: 999px; display: grid; place-items: center; }
  .nav-btn[aria-current="page"] .pill { background: var(--lime); }
  .nav-label { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
  .nav-btn[aria-current="page"] .nav-label { color: var(--ink); font-weight: 700; }
  .main { margin-left: 0; padding: 16px 14px 104px; }
  .header { flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
  .header .mobile-logo { display: block; }
  .header h1 { font-size: 24px; }
  .header p { font-size: 13px; }
  .header .search { width: 100%; height: 44px; }
  .hero { padding: 22px 18px 18px; gap: 18px; }
  .hero h2 { font-size: 21px; }
  .flow-icon { width: 48px; height: 48px; border-radius: 15px; }
  .flow-icon .icon { width: 24px; height: 24px; }
  .flow-value .num { font-size: 36px; }
  .flow-arrow { margin-left: 10px; }
  .progress .btn-dark { margin-left: 0; width: 100%; justify-content: space-between; }
  .cards { grid-template-columns: 1fr; }
  .card { padding: 20px 18px; }
  .big .num { font-size: 44px; }
  .output-body { flex-direction: column; }
  .shirts { grid-template-columns: repeat(7, 24px); }
  .tiles { grid-template-columns: 1fr; }
  .wan { font-size: 42px; }
  .panel { padding: 16px; background: transparent; }
  .panel-head { padding: 0 2px; }
  .batch-row { flex-wrap: wrap; gap: 10px 12px; padding: 14px; border-radius: 18px; background: #fff; }
  .batch.is-current .batch-row { background: #eef5f8; }
  .batch-icon { width: 42px; height: 42px; border-radius: 12px; }
  .batch-main { flex: 1 1 calc(100% - 120px); }
  .batch-weight { order: 3; flex-basis: 100%; text-align: left; display: flex; align-items: baseline; justify-content: space-between; }
  .batch-weight .v { justify-content: flex-start; }
  .chev { width: 38px; height: 38px; }
  .items { padding: 8px 0 0 12px; }
  .item-row {
    grid-template-columns: 1fr auto; grid-template-areas: "src w" "name state"; gap: 2px 10px;
    background: #fff; padding: 10px 12px; border-radius: 12px;
  }
  .item-row .id, .item-row .qty { display: none; }
  .item-row .src { display: block; grid-area: src; font-size: 12px; color: var(--muted); font-weight: 500; }
  .item-row .name { grid-area: name; font-size: 16px; font-weight: 700; }
  .item-row .w { grid-area: w; text-align: right; font-weight: 700; font-size: 17px; }
  .item-row .state { grid-area: state; font-size: 12px; }
}

[hidden] { display: none !important; }

@container (max-width: 420px) {
  .output-body { flex-direction: column; }
  .shirts { grid-template-columns: repeat(7, 24px); }
}
@media (max-width: 720px) {
  .progress .bar { order: 2; }
  .progress .btn-dark { order: 3; }
}
