@font-face { font-family: "TG Open Sans"; src: url("/static/fonts/OpenSans-Regular.ttf") format("truetype"); font-weight: 400; }
:root {
  --ground: #f4f3ef; --surface: #fff; --ink: #1b1c1e; --muted: #4a4e55; --faint: #5b5f66;
  --line: #e2e0da; --line-soft: #efede8; --nav: #16202b; --nav-active: #26384d; --nav-text: #c9d1da; --nav-dim: #8c99a8;
  --blue: #1f5fd1; --blue-ink: #174aa6; --blue-bg: #e3ecfb;
  --green: #1c7c54; --green-ink: #155c3e; --green-bg: #e6f4ec;
  --orange: #c2410c; --orange-ink: #7a3206; --orange-bg: #fdf1e3; --orange-line: #efc9a4;
  --red: #b42318; --red-ink: #a51e14; --red-bg: #fdecea; --red-line: #f1c4bf;
  --gray-bg: #eceae5;
  /* Latin monospace first so columns line up; Chinese labels fall back to a system font. */
  --mono: Consolas, "Cascadia Mono", "Courier New", ui-monospace, monospace;
  /* Telegram's message font, so the broadcast preview looks the way the group will see it. */
  --tg: "TG Open Sans", "Microsoft YaHei", "PingFang SC", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "IBM Plex Sans", "Noto Sans SC", "Microsoft YaHei", sans-serif; color: var(--ink); background: var(--ground); font-size: 14px; }
a { color: var(--blue); }
a:hover { color: #16479e; }
.shell { display: flex; min-height: 100vh; }
nav.side { width: 232px; flex-shrink: 0; background: var(--nav); padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--blue); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.brand b { color: #fff; font-size: 15px; display: block; }
.brand small { color: var(--nav-dim); font-size: 12px; }
nav.side .item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 9px; color: var(--nav-text); text-decoration: none; cursor: pointer; list-style: none; }
nav.side .item::-webkit-details-marker { display: none; }
nav.side .item:hover, nav.side .sub:hover { color: #fff; background: #1d2a38; }
nav.side .item.on { background: var(--nav-active); color: #fff; font-weight: 600; }
nav.side .item.here { color: #fff; }
nav.side .icon, nav.side .chevron { width: 19px; height: 19px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
nav.side .chevron { width: 16px; height: 16px; color: var(--nav-dim); transition: transform .15s; }
nav.side .navgroup[open] .chevron { transform: rotate(180deg); }
nav.side .navgroup[open] .badge.folded { display: none; }
nav.side .navgroup { display: flex; flex-direction: column; gap: 2px; }
nav.side .sub { display: flex; justify-content: space-between; align-items: center; min-height: 38px; padding: 0 12px 0 43px; border-radius: 9px; color: var(--nav-dim); text-decoration: none; font-size: 13.5px; }
nav.side .sub.on { background: var(--nav-active); color: #fff; font-weight: 600; }
nav.side .navgroup[open] > .sub:last-child { margin-bottom: 4px; }nav.side .badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--orange); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; }
nav.side .me { margin-top: auto; padding: 14px 12px; border-radius: 10px; background: #1d2a38; color: var(--nav-dim); font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
nav.side .me b { color: #fff; font-size: 14px; }
nav.side .me a { color: var(--nav-text); }
main { flex: 1; min-width: 0; padding: 28px 32px 40px; display: flex; flex-direction: column; gap: 18px; }
header.page { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
header.page h1 { margin: 0; font-size: 28px; }
header.page .sub { color: var(--faint); font-size: 14px; margin-top: 6px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.cols { display: flex; gap: 20px; align-items: flex-start; }
.cols > .side-panel { width: 400px; flex-shrink: 0; position: sticky; top: 20px; }
.cols > .side-panel.wide { width: 480px; max-height: calc(100vh - 40px); overflow-y: auto; }
.nowrap { white-space: nowrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { margin: 0; font-size: 17px; }
.card.red { border-color: var(--red-line); }
.card.orange { border-color: var(--orange-line); }
.muted { color: var(--faint); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid #d5d2ca; background: #fff; color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #a9a59b; color: var(--ink); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #16479e; color: #fff; }
.btn.danger { border: 2px solid var(--red); color: var(--red-ink); font-weight: 700; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.link { color: var(--blue); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.pill.blue { background: var(--blue-bg); color: var(--blue-ink); }
.pill.green { background: var(--green-bg); color: var(--green-ink); }
.pill.orange { background: var(--orange-bg); color: #9a3f07; }
.pill.red { background: var(--red-bg); color: var(--red-ink); }
.pill.gray { background: var(--gray-bg); color: var(--muted); }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th { text-align: left; font-weight: 500; font-size: 12px; color: var(--faint); padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.list td { padding: 9px 6px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.list tr.on td { background: #f3f6fc; }
table.list td.num, table.list th.num { text-align: right; font-family: var(--mono); }
.meter { height: 8px; border-radius: 999px; background: var(--gray-bg); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--green); transition: width .3s; }
.block { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.block h3 { margin: 0; font-size: 15px; }
.block > .pill, .block > form, .block > a.btn { align-self: flex-start; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], select, textarea {
  font: inherit; border: 1px solid #d5d2ca; border-radius: 8px; padding: 0 10px; height: 40px; background: #fff; color: var(--ink); }
textarea { padding: 10px; height: auto; font-family: var(--mono); font-size: 12px; resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 10px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--blue); }
.flash { padding: 10px 14px; border-radius: 10px; background: var(--green-bg); color: var(--green-ink); }
.flash.warn { background: var(--orange-bg); color: var(--orange-ink); }
.banner { padding: 12px 16px; border-radius: 12px; background: var(--orange-bg); border: 1px solid var(--orange-line); color: var(--orange-ink); }
pre.msg { margin: 0; font-family: var(--tg); font-size: 14px; line-height: 1.5; white-space: pre; overflow-x: auto; background: #fff; border-radius: 12px; padding: 14px 18px; box-shadow: 0 1px 2px rgba(22, 32, 43, .12); }
.chat { background: #d9e3ec; border-radius: 12px; padding: 18px; }
details.more > summary { cursor: pointer; color: var(--blue); list-style: none; font-size: 13px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 8px; }
.detail-box { padding: 10px 12px; border-radius: 8px; background: var(--ground); font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.drop { border: 2px dashed #b9c8e6; background: #f3f6fc; border-radius: 14px; padding: 24px; display: flex; align-items: center; gap: 20px; }
.drop.over { background: var(--blue-bg); }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.hero { background: var(--nav); border-radius: 18px; padding: 28px 32px; display: flex; align-items: center; gap: 24px; color: #c9d1da; }
.hero .big { font-size: 30px; color: #fff; font-weight: 700; font-family: var(--mono); }
.hero .title { color: #fff; font-size: 22px; font-weight: 700; }
.hero .warn { color: #f5c28e; }
.hero .btn { background: #fff; color: var(--nav); font-weight: 700; height: 52px; padding: 0 28px; }
.steps { background: #fff; border: 1px solid var(--line); border-radius: 18px; }
.steps a { display: flex; align-items: center; gap: 20px; padding: 22px 28px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line-soft); }
.steps a:last-child { border-bottom: none; }
.steps .n { width: 40px; height: 40px; border-radius: 999px; border: 2px solid #c9c6be; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); flex-shrink: 0; }
.steps .n.doing { background: var(--blue); border-color: var(--blue); color: #fff; }
.steps .n.done { background: var(--green); border-color: var(--green); color: #fff; }
.steps b { font-size: 17px; display: block; }
.center { max-width: 880px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.login { max-width: 380px; margin: 12vh auto; }
.sticky-bar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); margin: 0 -32px -40px; padding: 14px 32px; display: flex; align-items: center; gap: 14px; }
.tabs { display: flex; flex-direction: column; gap: 6px; width: 220px; flex-shrink: 0; }
.tabs a { height: 46px; display: flex; align-items: center; padding: 0 16px; border-radius: 10px; color: var(--ink); text-decoration: none; border: 1px solid transparent; }
.tabs a.on { border-color: var(--blue); background: #fff; color: var(--blue-ink); font-weight: 600; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--gray-bg); }
.seg a { flex: 1; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 500; }
.seg a.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(22, 32, 43, .12); }
a.group-name { color: var(--ink); font-weight: 700; text-decoration: none; }
a.group-name:hover { color: var(--blue); text-decoration: underline; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 8px; font-size: 12px; }
.chip.low { background: var(--orange-bg); color: var(--orange-ink); }
.chip.arrears { background: var(--red-bg); color: #8f1a11; }
.sentence { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--ground); }
@media (max-width: 1200px) {
  .cols { flex-direction: column; }
  .cols > .side-panel, .cols > .card { width: 100% !important; position: static !important; }
  .tabs { width: 100%; flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  nav.side { width: 100%; height: auto; position: static; padding: 10px 12px; gap: 2px; }
  .brand { padding: 0 8px 6px 0; width: 100%; }
  nav.side .item { min-height: 38px; }
  nav.side .sub { min-height: 34px; }
  nav.side .me { margin-top: 6px; width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
  main { padding: 16px; }
  header.page { flex-direction: column; align-items: flex-start; }
  .drop { flex-direction: column; align-items: flex-start; }
  .sticky-bar { margin: 0 -16px -40px; padding: 12px 16px; flex-wrap: wrap; }
  .hero { flex-direction: column; align-items: flex-start; padding: 20px; }
  table.list { display: block; overflow-x: auto; }
}
