@font-face {
  font-family: "Noto Sans TC";
  src: url("/static/fonts/noto-sans-tc-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans TC";
  src: url("/static/fonts/noto-sans-tc-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans TC";
  src: url("/static/fonts/noto-sans-tc-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans TC";
  src: url("/static/fonts/noto-sans-tc-900.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: light;
  --paper: #EEF1F5;
  --card: #FFFFFF;
  --ink: #16212B;
  --muted: #5B6573;
  --faint: #646F7D;
  --line-soft: #F0F2F5;
  --line-header: #E3E7ED;
  --line: #DCE1E8;
  --brand: #2B4ACB;
  --brand-hover: #1C33A0;
  --brand-soft: #E8EDFF;
  --alert: #D93A3A;
  --track: #EEF0F4;
  --shadow: 0 1px 2px rgba(22, 33, 43, .06), 0 4px 16px rgba(22, 33, 43, .04);
  --done: #2E9E66;
  --done-soft: #E3F5EB;
  --done-ink: #14794A;
  --sign: #E5B627;
  --sign-soft: #FFF6D6;
  --sign-ink: #7A5A00;
  --prep: #F08C2E;
  --prep-soft: #FFEEDB;
  --prep-ink: #9A3F00;
  --move: #3B7BE0;
  --move-soft: #E4EEFF;
  --move-ink: #1D4FA8;
  --ask: #8B5CF6;
  --ask-soft: #F0EAFF;
  --ask-ink: #5B33B0;
  --todo: #E5484D;
  --todo-soft: #FDECEC;
  --todo-ink: #B42318;
  --remark: #8A4B00;
}
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", sans-serif;
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

.top {
  background: var(--card);
  border-bottom: 1px solid var(--line-header);
}
.top-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 900;
  font-size: 18px;
}
.brand:hover { color: var(--ink); }
.nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1 1 auto; }
.nav a {
  color: #4A5563;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav a:hover { background: #F1F3F7; color: var(--ink); }
.nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.nav a.on.alert { background: var(--todo-soft); color: var(--todo-ink); }
.badge {
  background: var(--alert);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F3F5F8;
  border-radius: 10px;
  padding: 0 12px;
  height: 40px;
  width: 260px;
  max-width: 100%;
}
.search input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 14px;
  color: var(--ink);
}
.button, button.primary, .upload-open {
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.button:hover, button.primary:hover, .upload-open:hover { background: var(--brand-hover); color: #fff; }
.button.secondary, button.secondary, button.ghost {
  background: #fff;
  color: #2A3542;
  border: 1px solid var(--line);
  font-weight: 500;
}
.button.secondary:hover, button.ghost:hover { background: #F7F8FA; color: var(--ink); }
.mobile-upload { display: none; }
.logout-form { margin: 0; }
.logout-form button { height: 40px; padding: 0 12px; }

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 32px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
h1 { margin: 0; font-size: 32px; font-weight: 900; letter-spacing: 0.02em; }
h2 { margin: 0; font-size: 22px; font-weight: 900; }
h3 { margin: 0; font-size: 20px; font-weight: 900; }
.lede, .section-note { color: var(--muted); font-size: 14px; margin: 0; }

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.card.pad { padding: 24px 28px; }
.search-page { display: flex; gap: 8px; align-items: center; }
.search-page input { flex: 1; height: 40px; }
.month-row, .page-head, .agent-head, .section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.month-title { display: flex; align-items: center; gap: 8px; }
.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 20px;
  color: #4A5563;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}
.icon-button:hover { color: var(--ink); }
.month-copy { font-size: 14px; color: var(--muted); }
.stale, .missing { color: #9A3F00; font-weight: 700; }
.month-sub { display: none; }

.summary {
  padding: 28px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px 40px;
  align-items: center;
}
.hero {
  font-size: 72px;
  font-weight: 900;
  line-height: 1.05;
  color: var(--ink);
}
.hero-line { display: flex; align-items: baseline; gap: 10px; }
.hero-suffix { font-size: 18px; color: var(--muted); }
.rate-line { margin-top: 14px; display: flex; align-items: center; gap: 12px; }
.rate-track, .thin-track {
  height: 10px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}
.rate-track > i, .thin-track > i { display: block; height: 100%; background: var(--done); border-radius: 999px; }
.rate-label { font-size: 15px; font-weight: 700; color: var(--done-ink); white-space: nowrap; }
.bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--track);
  gap: 2px;
}
.bar.thick { height: 14px; }
.bar i { display: block; min-width: 0; }
.bar i.CLOSED, .dot.CLOSED { background: var(--done); }
.bar i.PENDING_SIGN, .dot.PENDING_SIGN { background: var(--sign); }
.bar i.PENDING_CONTRACT, .dot.PENDING_CONTRACT { background: var(--prep); }
.bar i.TRANSFER_PENDING, .dot.TRANSFER_PENDING { background: var(--move); }
.bar i.UNKNOWN, .dot.UNKNOWN { background: var(--ask); }
.bar i.NO_REPORT, .dot.NO_REPORT { background: var(--todo); }
.stage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 20px;
  font-size: 14px;
  margin-top: 14px;
}
.stage-grid div, .stage-line span { display: flex; justify-content: space-between; gap: 8px; }
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: 1px;
}
.stage-line { display: none; }
.change-box {
  background: #F4F7FF;
  border-radius: 12px;
  padding: 18px 20px;
}
.change-box h2 { font-size: 15px; color: var(--brand); margin-bottom: 8px; }
.change-box p { margin: 0; font-size: 15px; line-height: 1.7; color: #2A3542; }

.store-columns { columns: 2 540px; column-gap: 20px; }
.store { break-inside: avoid; margin: 0 0 20px; }
.store-head, .overdue-head {
  padding: 18px 20px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}
.store-meta { font-size: 14px; color: var(--muted); }
.store-meta b { color: var(--ink); font-size: 18px; }
.store-rate { flex: 1 1 120px; display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.store-rate .thin-track { width: 120px; height: 6px; }
.store-rate span { font-size: 13px; color: var(--done-ink); font-weight: 700; min-width: 32px; }
.agent-row {
  display: grid;
  grid-template-columns: minmax(72px, max-content) minmax(0, 1fr) 76px;
  align-items: center;
  column-gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--line-soft);
}
.agent-row:hover { background: #FAFBFD; }
.agent-row a { font-size: 16px; font-weight: 700; }
.agent-count { text-align: right; font-size: 14px; color: var(--muted); white-space: nowrap; }
.agent-count b { font-size: 18px; color: var(--ink); }
.agent-count b.done { color: var(--done-ink); }
.dots {
  grid-column: 2 / 4;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 13px;
  color: #4A5563;
  margin-top: 6px;
}
.delta {
  font-size: 12px;
  font-weight: 700;
  color: var(--done-ink);
  background: var(--done-soft);
  border-radius: 6px;
  padding: 1px 6px;
}

.crumb { display: flex; align-items: center; gap: 8px; font-size: 15px; color: #4A5563; margin: 0; }
.crumb b { color: var(--ink); }
.agent-kicker { font-size: 15px; color: var(--muted); }
.agent-head h1 { font-size: 36px; margin-top: 4px; }
.agent-stats { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.stat { padding: 14px 22px; min-width: 110px; }
.stat span { font-size: 13px; color: var(--muted); }
.stat strong { display: block; font-size: 32px; font-weight: 900; }
.stat.quiet strong { color: var(--muted); }
.stat.good strong { color: var(--done-ink); }
.tabs { display: flex; border-bottom: 1px solid var(--line); gap: 24px; }
.tab {
  padding: 12px 4px;
  font-size: 16px;
  color: var(--muted);
  border-bottom: 3px solid transparent;
}
.tab.on { color: var(--ink); font-weight: 700; border-bottom-color: var(--brand); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter {
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 14px;
  color: #2A3542;
  display: inline-flex;
  align-items: center;
}
.filter.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter:hover { color: var(--ink); }
.filter.on:hover { color: #fff; }

.table-scroll { overflow-x: auto; max-width: 100%; }
.case-sheet { min-width: 960px; }
.case, .case-head {
  display: grid;
  grid-template-columns: minmax(200px, 1.4fr) 104px 96px minmax(180px, 1fr) 80px minmax(140px, 1fr);
  align-items: center;
  column-gap: 20px;
  padding: 14px 24px;
  border-top: 1px solid var(--line-soft);
  font-size: 15px;
}
.case-overdue {
  grid-template-columns: 72px minmax(190px, 1.3fr) 104px 96px 88px minmax(160px, 1.4fr);
  column-gap: 18px;
}
.case:hover { background: #FAFBFD; }
.case-head { font-size: 13px; color: var(--faint); font-weight: 500; padding-top: 10px; padding-bottom: 10px; border-top: 0; }
.group-label {
  padding: 10px 24px;
  background: #F6F8FB;
  border-top: 1px solid #EDF0F4;
  font-size: 14px;
  font-weight: 700;
  color: #4A5563;
}
.group-label span { font-weight: 400; color: var(--faint); }
.party { color: var(--ink); }
.party b { font-size: 16px; }
.party .who { color: var(--faint); font-weight: 400; }
.party small { display: block; font-size: 13px; color: var(--faint); font-weight: 400; }
.remark { font-size: 14px; color: var(--remark); }
.chip {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  background: #F1F3F7;
  color: #2A3542;
}
.chip.NO_REPORT { background: var(--todo-soft); color: var(--todo-ink); }
.chip.PENDING_CONTRACT { background: var(--prep-soft); color: var(--prep-ink); }
.chip.PENDING_SIGN { background: var(--sign-soft); color: var(--sign-ink); }
.chip.TRANSFER_PENDING { background: var(--move-soft); color: var(--move-ink); }
.chip.UNKNOWN { background: var(--ask-soft); color: var(--ask-ink); }
.chip.RENEWED, .chip.TRANSFERRED, .chip.NOT_RENEWED, .chip.CLOSED { background: var(--done-soft); color: var(--done-ink); }
.chip.TERMINATED { background: #F1F3F7; color: #2A3542; }
.late {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 26px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  background: #F1F3F7;
  color: #2A3542;
}
.late.long { background: #B42318; color: #fff; }
.late.mid { background: #FFE4CC; color: #9A3F00; }
.danger { color: #B42318; }
.warm { color: #C2410C; }
.late-stats { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: #4A5563; }

.cards-only { display: none; }
.mobile-card {
  display: block;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin: 0 0 12px;
  color: var(--ink);
}
.mobile-card strong { font-size: 1.15rem; font-weight: 900; }
.tenant-name { color: var(--faint); font-size: 0.86rem; }
.mobile-card .meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.notice ul { margin: 8px 0 0; padding-left: 18px; }
.warn { color: var(--todo-ink); }
.ok { color: var(--done-ink); }
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], textarea, select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}
.check { flex-direction: row; align-items: center; color: var(--ink); }
.store-setting {
  display: grid;
  gap: 6px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}
.search-results { list-style: none; padding: 0; margin: 0; }
.search-results li { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.search-results a { font-weight: 700; margin-right: 8px; }
.history { margin: 0; padding: 0; list-style: none; }
.history li { padding: 12px 0; border-top: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); vertical-align: -2px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 12px 14px; border-top: 1px solid var(--line-soft); vertical-align: top; }
th { font-size: 13px; color: var(--faint); font-weight: 500; border-top: 0; }

.overdue-banner { display: none; }
.tabbar, .more-sheet { display: none; }
.store-mobile { display: none; }

.upload-dialog {
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(560px, calc(100% - 32px));
  box-shadow: var(--shadow);
}
.upload-dialog::backdrop { background: rgba(22, 33, 43, .35); }
.upload-dialog form { padding: 20px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.drop {
  margin-top: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  background: #F7F8FA;
}
.drop.over { background: var(--brand-soft); }
.upload-list { list-style: none; padding: 0; margin: 12px 0; }
.upload-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; margin: 8px 0; }
.upload-list .remove-file { height: 32px; padding: 0 10px; }
.upload-list .reason { grid-column: 1 / -1; color: var(--todo-ink); }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login h1 { font-size: 28px; display: flex; align-items: center; gap: 10px; }

@media (max-width: 767px) {
  .top-inner { padding: 12px 16px; gap: 10px; }
  .nav, .search, .desktop-upload, .logout-form { display: none; }
  .mobile-upload { display: inline-flex; height: 40px; padding: 0 14px; margin-left: auto; }
  main { padding: 16px 16px 96px; gap: 14px; }
  h1 { font-size: 20px; }
  .month-row { justify-content: space-between; align-items: center; }
  .month-title { flex: 1; justify-content: space-between; }
  .month-title h1 { font-size: 20px; text-align: center; margin: 0; }
  .month-copy { display: none; }
  .month-sub { display: block; text-align: center; font-size: 12px; color: var(--faint); }
  .icon-button { width: 44px; height: 44px; }
  .hero { font-size: 52px; }
  .summary { padding: 18px; gap: 12px; }
  .summary-stages .stage-grid, .change-box, .rate-line { display: none; }
  .stage-line {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    font-size: 12px;
    color: #4A5563;
    margin-top: 10px;
  }
  .stage-line b.done { color: var(--done-ink); }
  .bar.thick { height: 12px; margin: 12px 0 0; }
  .overdue-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--ink);
    background: #FFF4F2;
  }
  .overdue-banner:hover { color: var(--ink); }
  .overdue-count {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--alert);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
  }
  .store-columns { display: none; }
  .store-mobile { display: flex; flex-direction: column; gap: 14px; }
  .arow, .srow {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 52px;
    align-items: center;
    column-gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--line-soft);
    min-height: 44px;
    color: var(--ink);
  }
  .srow { display: grid; grid-template-columns: 56px minmax(0, 1fr) 60px 16px; height: 56px; }
summary.srow { list-style: none; }
summary.srow::-webkit-details-marker { display: none; }
  .store-card .extra { display: none; }
  .store-card.show-extra .extra { display: grid; }
  .more-agents {
    width: 100%;
    height: 44px;
    border: 0;
    border-top: 1px solid var(--line-soft);
    background: #fff;
    color: var(--brand);
    font-size: 14px;
  }
  .desktop-only { display: none; }
  .cards-only { display: block; }
  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-top: 1px solid var(--line-header);
    padding-bottom: 10px;
    z-index: 6;
  }
  .tabbar a, .tabbar button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--faint);
    padding-top: 8px;
    min-height: 44px;
    background: transparent;
    border: 0;
    font-weight: 400;
  }
  .tabbar a.on, .tabbar button.on { color: var(--brand); font-weight: 700; }
  .more-sheet[hidden] { display: none !important; }
  .more-sheet {
    display: block;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 72px;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow);
    z-index: 7;
    padding: 8px;
  }
  .more-sheet a, .more-sheet button {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    padding: 0 14px;
    border-radius: 10px;
    color: var(--ink);
    background: transparent;
    border: 0;
    text-align: left;
  }
  button.primary, .button, .upload-open, .icon-button, .filter { min-height: 44px; }
  .button, button.primary, .upload-open { height: 44px; }
  .upload-list li { grid-template-columns: 1fr; }
  .upload-dialog { margin: auto 0 0 0; width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; }
}
