/* 收款通道控制台 —— 共用样式
 *
 * 视觉基调参照 WorkBuddy Manager：白底 + 浅灰卡片 + 1px 浅灰描边 +
 * 近黑正文 + 灰色次要文字，大圆角、少阴影、信息密度高。
 * 强调色用支付宝蓝 #1677ff（品牌主色）。
 * 全部本地托底，不引任何 CDN（国内服务器拉不到境外资源）。
 */

:root {
  /* 支付宝蓝 */
  --brand:       #1677ff;
  --brand-light: #4096ff;
  --brand-dark:  #0958d9;
  --brand-soft:  #eaf3ff;   /* 浅蓝底，用于选中/提示块 */

  --bg:        #fafafa;     /* 页面底：极浅灰，白卡片才浮得起来 */
  --bg-raise:  #ffffff;     /* 卡片 */
  --bg-sunken: #f4f4f5;     /* 表头 / 凹陷面 */

  --line:        #e8e8ea;
  --line-strong: #d6d6db;

  --ink:       #09090b;     /* 近黑正文 */
  --ink-dim:   #71717a;     /* 次要文字 */
  --ink-faint: #a1a1aa;     /* 更弱的说明文字 */

  /* 信号色。浅底上必须比深色主题更深，否则对比度不够看不清。 */
  --ok:   #0d9b6c;
  --warn: #c2740a;
  --bad:  #d92d20;

  --ok-soft:   #e9f9f2;  --ok-line:   #a9e6cd;
  --warn-soft: #fff7e6;  --warn-line: #f5d99a;
  --bad-soft:  #fef1f0;  --bad-line:  #f6c4c0;

  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
          "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Consolas,
          "Noto Sans Mono CJK SC", monospace;

  --r: 12px;
  --shadow: 0 1px 2px rgba(9, 9, 11, .04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 16px 64px;
  background: var(--bg);
  /* 极淡的点阵，给大白底一点质感，不喧宾夺主 */
  background-image: radial-gradient(rgba(9, 9, 11, .045) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }
.ok  { color: var(--ok); }
.bad { color: var(--bad); }
.warn{ color: var(--warn); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶栏 ---------- */

.topbar {
  display: flex; align-items: baseline; gap: 14px;
  padding: 24px 0 16px; margin-bottom: 20px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.topbar h1 { font-size: 17px; font-weight: 650; margin: 0; letter-spacing: -.01em;
             display: flex; align-items: center; }
.topbar h1::before { content: ""; width: 9px; height: 9px; border-radius: 2px;
                     background: var(--brand); margin-right: 10px; flex: none; }
.topbar nav { margin-left: auto; display: flex; gap: 18px; font-size: 13.5px; }
.topbar nav a { color: var(--ink-dim); }
.topbar nav a:hover { color: var(--brand); }

/* ---------- 读数条 ---------- */

.rail {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.rail-cell { padding: 15px 18px; border-left: 1px solid var(--line); }
.rail-cell:first-child { border-left: 0; }
.rail-k {
  font-size: 11.5px; color: var(--ink-faint); margin-bottom: 7px; letter-spacing: .01em;
}
.rail-v {
  font-family: var(--mono); font-size: 19px; font-weight: 650;
  font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px;
}
.led {
  width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ink-faint);
}
.led.on   { background: var(--ok);   box-shadow: 0 0 0 3px rgba(13,155,108,.16); }
.led.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(194,116,10,.16); }
.led.bad  { background: var(--bad);  box-shadow: 0 0 0 3px rgba(217,45,32,.16);
            animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(217,45,32,.16); }
  50%     { box-shadow: 0 0 0 7px rgba(217,45,32,.05); }
}

/* ---------- 指标卡 ---------- */

.metrics { display: grid; grid-template-columns: repeat(4, 1fr);
           gap: 12px; margin-bottom: 24px; }
.metric {
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--r); padding: 17px 18px; box-shadow: var(--shadow);
}
.metric-k { font-size: 12px; color: var(--ink-dim); margin-bottom: 10px; }
.metric-v { font-family: var(--mono); font-size: 27px; font-weight: 650;
            font-variant-numeric: tabular-nums; line-height: 1.1;
            letter-spacing: -.02em; }
.metric-v .unit { font-size: 14px; color: var(--ink-dim); margin-left: 3px; }
.metric-sub { font-size: 12px; color: var(--ink-faint); margin-top: 9px; }

/* ---------- 区块标题 ---------- */

h2.sec {
  font-size: 14px; font-weight: 650; color: var(--ink);
  margin: 28px 0 12px; letter-spacing: -.01em;
}

/* ---------- 待处理 ---------- */

.todo-clear {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--bg-raise);
  color: var(--ink-dim); font-size: 13.5px; box-shadow: var(--shadow);
}
.todo-list { display: grid; gap: 10px; }
.todo {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: var(--r);
  background: var(--warn-soft); border: 1px solid var(--warn-line);
}
.todo.crit { background: var(--bad-soft); border-color: var(--bad-line); }
.todo-t { font-weight: 650; font-size: 13.5px; }
.todo-d { color: var(--ink-dim); font-size: 12.5px; margin-top: 2px; }
.todo a { margin-left: auto; white-space: nowrap; font-size: 13px; font-weight: 500; }

/* ---------- 账号卡 ---------- */

.accounts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.acct {
  background: var(--bg-raise); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px; display: flex; flex-direction: column;
  gap: 13px; box-shadow: var(--shadow);
}
.acct-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.acct-name { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.acct-uid { font-family: var(--mono); font-size: 12px; color: var(--ink-faint);
            word-break: break-all; }
.acct-rows { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px;
             font-size: 12.5px; margin: 0; }
.acct-rows dt { color: var(--ink-faint); }
.acct-rows dd { margin: 0; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.acct-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
             margin-top: auto; padding-top: 13px; border-top: 1px solid var(--line); }

.badge {
  font-size: 11.5px; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--ink-dim);
  background: var(--bg-sunken); white-space: nowrap; line-height: 1.65;
  font-weight: 500;
}
.badge.ok   { color: var(--ok);   border-color: var(--ok-line);   background: var(--ok-soft); }
.badge.warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.badge.bad  { color: var(--bad);  border-color: var(--bad-line);  background: var(--bad-soft); }

/* 日限额进度条 */
.bar { height: 5px; border-radius: 3px; background: #ececef; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand);
           border-radius: 3px; transition: width .4s ease; }
.bar > i.warn { background: var(--warn); }
.bar > i.bad  { background: var(--bad); }

/* ---------- 表格 ---------- */

.tablewrap { border: 1px solid var(--line); border-radius: var(--r);
             overflow-x: auto; background: var(--bg-raise); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-dim);
  padding: 11px 14px; border-bottom: 1px solid var(--line);
  background: var(--bg-sunken); white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafafb; }
td.num, th.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* 单元格不折行：窄屏宁可横向滚动，也别把公司名压成一字一行 */
th, td { white-space: nowrap; }
.cellwrap { white-space: normal; word-break: break-all; }

.empty { padding: 34px 16px; text-align: center; color: var(--ink-faint); font-size: 13px; }

/* ---------- 筛选药丸 ---------- */

.pills { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.pill {
  font-size: 12.5px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--ink-dim);
  background: var(--bg-raise); font-weight: 500;
}
.pill[aria-current="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.pill:hover { text-decoration: none; border-color: var(--brand-light); color: var(--brand); }
.pill[aria-current="true"]:hover { color: #fff; }

/* ---------- 表单 ---------- */

.field { display: grid; grid-template-columns: 168px 1fr; gap: 10px 14px;
         align-items: center; margin-bottom: 14px; }
.field > label { color: var(--ink); font-size: 13.5px; font-weight: 500; }
.field .hint { grid-column: 2; font-size: 12px; color: var(--ink-faint); margin-top: -6px; }

input, select {
  width: 100%; max-width: 320px; padding: 8px 11px; font-size: 13.5px;
  color: var(--ink); background: var(--bg-raise);
  border: 1px solid var(--line-strong); border-radius: 8px;
  font-family: var(--mono);
}
input:focus, select:focus { outline: none; border-color: var(--brand);
                            box-shadow: 0 0 0 3px rgba(22,119,255,.14); }
input::placeholder { color: var(--ink-faint); font-family: var(--sans); }

button {
  padding: 7px 14px; font-size: 13px; font-family: var(--sans); font-weight: 500;
  color: var(--ink); background: var(--bg-raise);
  border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
button:hover { border-color: var(--brand-light); color: var(--brand); background: var(--brand-soft); }
button.primary { background: var(--brand); color: #fff; border-color: var(--brand);
                 font-weight: 600; }
button.primary:hover { background: var(--brand-light); border-color: var(--brand-light);
                       color: #fff; }
button.danger { color: var(--bad); border-color: var(--bad-line); }
button.danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }

/* ---------- 折叠区 ---------- */

details.panel {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--bg-raise); margin-bottom: 12px; overflow: hidden;
  box-shadow: var(--shadow);
}
details.panel > summary {
  padding: 15px 18px; cursor: pointer; font-size: 13.5px; font-weight: 550;
  color: var(--ink); list-style: none; display: flex; align-items: center; gap: 9px;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before {
  content: "▸"; color: var(--ink-faint); transition: transform .18s;
}
details.panel[open] > summary::before { transform: rotate(90deg); }
details.panel > summary:hover { color: var(--brand); }
details.panel > .body { padding: 6px 18px 20px; border-top: 1px solid var(--line); }

/* ---------- 提示条 ---------- */

.flash { padding: 12px 16px; border-radius: var(--r); margin-bottom: 14px;
         font-size: 13.5px; border: 1px solid; font-weight: 500; }
.flash.error { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.flash.ok    { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }

/* ---------- 入场动效 ---------- */

.rise { animation: rise .4s cubic-bezier(.22,.61,.36,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.rise:nth-child(1) { animation-delay: .02s } .rise:nth-child(2) { animation-delay: .06s }
.rise:nth-child(3) { animation-delay: .10s } .rise:nth-child(4) { animation-delay: .14s }
.rise:nth-child(5) { animation-delay: .18s } .rise:nth-child(6) { animation-delay: .22s }
.rise:nth-child(7) { animation-delay: .26s } .rise:nth-child(8) { animation-delay: .30s }
/* 局部刷新换掉内容时，别重播入场动画（每 30 秒闪一下会很烦） */
.refreshed .rise { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .rise, .led.bad { animation: none; }
  .bar > i { transition: none; }
}

/* ---------- 居中单卡页（密码门 / 充值页 / 上号页 / 验证页） ---------- */

.center-page { min-height: 100vh; display: flex; justify-content: center;
               align-items: flex-start; padding: 44px 12px 60px; }
.panel-card { background: var(--bg-raise); border: 1px solid var(--line);
              border-radius: 16px; padding: 28px; width: 100%; max-width: 460px;
              box-shadow: 0 1px 3px rgba(9,9,11,.05); }
.panel-card.wide { max-width: 800px; }   /* 上号页有 6 列表，窄了会横向溢出 */
.panel-card h1 { font-size: 18px; margin: 0 0 6px; letter-spacing: -.01em; }
.panel-card .lead { color: var(--ink-dim); font-size: 13px; margin: 0 0 20px; }
.navlinks { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line);
            display: flex; gap: 18px; justify-content: center; font-size: 13px; }
.panel-card input:not([type=password]):not([name=password]) { max-width: none; }
.panel-card form > input { width: 100%; margin-bottom: 12px; }
.panel-card form > button { width: 100%; padding: 11px; font-size: 14px; }

/* ---------- 充值页 ---------- */

.panel-card label { display: block; font-size: 13px; color: var(--ink-dim); margin: 0 0 6px; }
.amount-show { font-family: var(--mono); font-size: 28px; font-weight: 650;
               font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
#qrcode { display: flex; justify-content: center; margin: 18px 0; }
#qrcode img, #qrcode svg { width: 240px; height: 240px; display: block; }
#launch { display: inline-block; margin-top: 14px; padding: 11px 22px;
          background: var(--brand); color: #fff; border-radius: 10px;
          font-size: 15px; font-weight: 600; }
#launch:hover { text-decoration: none; background: var(--brand-light); }
.howto { margin-top: 18px; padding: 15px; border-radius: 10px; text-align: left;
         background: var(--brand-soft); border: 1px solid #cfe4ff; }
.howto-t { font-size: 13.5px; font-weight: 650; color: var(--brand-dark); }
.howto-s { font-size: 13px; color: var(--ink-dim); line-height: 1.95; margin-top: 5px; }
.howto-warn { margin-top: 11px; font-size: 13px; color: var(--bad); font-weight: 650; }
#status { margin-top: 16px; font-size: 16px; font-weight: 650; }
#countdown { color: var(--ink-faint); font-size: 13px; margin-top: 6px; }
.err { color: var(--bad); font-size: 13px; margin-top: 8px; display: none; }
.tip { font-size: 12.5px; color: var(--ink-dim); margin-top: 10px; line-height: 1.7; }
.qr-who { font-size: 13px; color: var(--ink-dim); margin-top: 10px; }

/* ---------- 窄屏 ---------- */

@media (max-width: 760px) {
  body { padding: 0 12px 48px; font-size: 13.5px; }
  .rail { grid-template-columns: repeat(2, 1fr); }
  .rail-cell:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .rail-cell:nth-child(4) { border-top: 1px solid var(--line); }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric-v { font-size: 23px; }
  .accounts { grid-template-columns: 1fr; }
  .field { grid-template-columns: 1fr; gap: 6px; }
  .field .hint { grid-column: 1; }
  .topbar nav { width: 100%; margin-left: 0; gap: 16px; }
  .tablewrap table { min-width: 620px; }
  /* 上号页在手机上要能一屏看全：UID 是次要信息，窄屏收起，
     让「重新登录」按钮不用横向滚动就能点到 */
  /* 上号页在手机上：表格摊成卡片。窄屏硬塞 6 列会把表头压成一字一行、
     按钮竖着排，还不如按"名称 / 状态+剩余 / 整行按钮"三段堆起来。 */
  .tablewrap table.compact { min-width: 0; }
  table.compact thead { display: none; }
  table.compact, table.compact tbody { display: block; }
  table.compact tr {
    display: grid; grid-template-columns: auto 1fr; gap: 7px 10px;
    padding: 13px 2px; border-bottom: 1px solid var(--line);
  }
  table.compact tr:last-child { border-bottom: 0; }
  table.compact td { display: block; border: 0; padding: 0; white-space: nowrap; }
  table.compact td:nth-child(1),      /* ID 收起 */
  table.compact td.col-uid { display: none; }   /* UID 收起 */
  table.compact td:nth-child(2) { grid-area: 1 / 1 / 2 / 3; white-space: normal;
                                  font-weight: 600; }
  table.compact td:nth-child(4) { grid-area: 2 / 1 / 3 / 2; align-self: center; }
  table.compact td:nth-child(5) { grid-area: 2 / 2 / 3 / 3; align-self: center;
                                  text-align: right; }
  table.compact td:nth-child(6) { grid-area: 3 / 1 / 4 / 3; }
  table.compact td:nth-child(6) button { width: 100%; }
}
