/* 令牌：Sowlab 统一规范方向 B（Notion 骨架 + 数据基座绿做唯一品牌色，2026-09-30）。旧变量名保留，指向新值。 */
:root {
  --bg:#FFFFFF; --panel:#FFFFFF; --line:rgba(55,53,47,.12); --line-strong:rgba(55,53,47,.20); --divider:rgba(55,53,47,.09);
  --ink:#37352F; --muted:rgba(55,53,47,.65); --ink-3:rgba(55,53,47,.45);
  --accent:#1F7A5C; --accent-hover:#175F48; --accent-ring:rgba(31,122,92,.15);
  --pos:#448361; --neg:#E03E3E; --neg-line:rgba(224,62,62,.35); --warn:#D9730D; --neutral:#787774;
  --soft-pos:#EDF3EC; --soft-neg:#FDEBEC; --soft-warn:#FBECDD; --neutral-soft:#F1F1EF;
  --hover:rgba(55,53,47,.06); --active:rgba(55,53,47,.10); --paper-side:#F7F7F5;
  --dark:#FFFFFF; --dark2:#F7F7F5;   /* 原深色顶栏两色，现改浅 */
  --toast-bg:#1F1F1F;
  --shadow-pop:0 0 0 1px rgba(15,15,15,.05),0 3px 6px rgba(15,15,15,.10),0 9px 24px rgba(15,15,15,.20);
  --shadow-toast:0 4px 12px rgba(15,15,15,.25);
}
* { box-sizing: border-box; }
body { margin:0; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button { display:inline-flex; align-items:center; justify-content:center; height:32px; padding:0 12px;
  border-radius:6px; border:1px solid var(--accent); background: var(--accent); color:#fff; font-weight:500;
  line-height:1; white-space:nowrap; cursor:pointer; }
button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.secondary { background:var(--panel); border-color:var(--line-strong); color:var(--ink); }
button.secondary:hover { background:var(--hover); border-color:var(--line-strong); }
button.danger { background:var(--panel); border-color:var(--neg-line); color:var(--neg); }
button.danger:hover { background:var(--soft-neg); border-color:var(--neg-line); }
button.link { height:auto; background:none; border-color:transparent; color:var(--accent); padding:0 4px;
  line-height:20px; border-radius:4px; }
button.link:hover { background:var(--hover); border-color:transparent; }
button:disabled { opacity:.5; cursor:default; }
button:disabled:hover { background: var(--accent); border-color: var(--accent); }
button.secondary:disabled:hover, button.danger:disabled:hover { background:var(--panel); border-color:var(--line-strong); }
button.link:disabled:hover { background:none; border-color:transparent; }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea { border:1px solid var(--line-strong);
  border-radius:6px; background:var(--panel); color:var(--ink); width:100%; }
input[type=text], input[type=password], input[type=email], input[type=number], select { height:32px; padding:0 10px; }
textarea { padding:6px 10px; }
input::placeholder, textarea::placeholder { color:var(--ink-3); }
input:focus, select:focus, textarea:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-ring); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
textarea { font-family: ui-monospace, Consolas, "Microsoft YaHei", monospace; font-size:13px; line-height:1.45; }
label { display:block; font-size:12px; color:var(--muted); margin-bottom:4px; }
.field { margin-bottom:12px; }
.mt { margin-top:10px; }
.row { display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; }
.row > * { flex:1 1 180px; }
.row > .auto { flex:0 0 auto; }
.card { background:var(--panel); border:1px solid var(--line); border-radius:8px; padding:16px 18px; margin-bottom:16px; box-shadow:none; }
.card h2 { margin:0 0 12px; font-size:16px; font-weight:600; }
.card h3 { margin:14px 0 8px; font-size:14px; color:var(--muted); font-weight:600; }
.muted { color:var(--muted); }
.small { font-size:12px; }
.err { color:var(--neg); }
.ok { color:var(--pos); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size:12px; }
pre { background:var(--paper-side); color:var(--ink); border:1px solid var(--line); padding:12px 14px;
  border-radius:8px; overflow:auto; font-size:12px; }
table { width:100%; border-collapse:collapse; }
th, td { text-align:left; padding:8px 12px; line-height:20px; border-bottom:1px solid var(--divider); vertical-align:middle; }
th { font-size:13px; color:var(--muted); font-weight:500; background:var(--panel); border-bottom-color:var(--line); white-space:nowrap; }
tr:hover td { background:var(--hover); }
th.num, td.num { text-align:right; font-variant-numeric:tabular-nums; }
.tag { display:inline-flex; align-items:center; height:20px; padding:0 6px; border-radius:3px; font-size:12px;
  font-weight:500; line-height:1; background:var(--neutral-soft); color:var(--neutral); margin-right:4px;
  white-space:nowrap; margin-bottom:2px; vertical-align:middle; }
.tag.off { background:var(--soft-neg); color:var(--neg); }
.tag.on { background:var(--soft-pos); color:var(--pos); }
.tag.warn { background:var(--soft-warn); color:#A0520C; }   /* 橙字压深一档：浅橙底上原色对比度只有 2.8，读不清 */
td .small.muted + .tag { margin-left:6px; }
.actions { white-space:nowrap; }
.actions button { margin-right:4px; }
/* ---- 人员页：密表格 + 一页内编辑 ---- */
table.dense th, table.dense td { font-size:13px; }
table.dense tr.off td { color:var(--muted); }
.card .row h2 { flex:1 1 auto; margin:0; }
.access h3 { margin-top:10px; }
.access td { vertical-align:top; }
.access label.on { display:inline; font-size:14px; color:var(--ink); }
.access select { width:auto; min-width:150px; }
.scope-opts label { display:inline; margin-right:12px; font-size:13px; color:var(--ink); }
.picker { border:1px solid var(--line); border-radius:8px; padding:8px 10px; background:var(--paper-side); margin-top:6px; }
.picker-head { display:flex; align-items:center; gap:10px; }
.picker-head input { max-width:260px; height:28px; padding:0 8px; }
.picker-list { display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:1px 12px;
  max-height:220px; overflow:auto; margin-top:6px; }
.picker-group { grid-column:1 / -1; font-size:12px; color:var(--muted); font-weight:600; margin-top:6px; }
.picker-item { display:block; font-size:13px; color:var(--ink); margin:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.picker-item.off { color:var(--muted); }

/* ---- 顶栏与三级导航（浅色：白底 + 1px 底线） ---- */
header#top { display:flex; align-items:center; gap:8px; padding:0 20px; background:var(--dark); color:var(--ink);
  box-shadow:0 1px 0 var(--line); position:sticky; top:0; z-index:20; height:52px; }
.brand { display:flex; align-items:center; gap:8px; color:var(--ink); text-decoration:none; font-weight:600;
  font-size:16px; margin-right:18px; }
.logo { width:22px; height:22px; display:block; }
.spacer { flex:1; }
.nav { display:flex; align-items:stretch; height:52px; }
.nav .cat { position:relative; display:flex; align-items:center; }
.nav .cat > a { display:flex; align-items:center; height:52px; padding:0 18px; color:var(--ink); text-decoration:none; font-size:15px; }
.nav .cat:hover > a, .nav .cat.open > a { background:var(--hover); }
.nav .panel { display:none; position:absolute; top:52px; left:0; min-width:520px; max-width:90vw;
  background:var(--panel); color:var(--ink); border-radius:8px; padding:6px 14px 10px; box-shadow:var(--shadow-pop);
  z-index:30; }
.nav .cat.open .panel { display:block; }
.nav .grp { display:flex; align-items:flex-start; padding:10px 0; border-bottom:1px solid var(--divider); }
.nav .grp:last-child { border-bottom:0; }
.nav .grp .gname { flex:0 0 110px; color:var(--muted); font-size:13px; padding:6px 10px 6px 0;
  border-right:1px solid var(--line); margin-right:8px; white-space:nowrap; }
.nav .grp .items { display:flex; flex-wrap:wrap; gap:0; flex:1; }
.nav .grp .items a { color:var(--ink); text-decoration:none; padding:6px 14px; border-radius:6px; white-space:nowrap; font-weight:500; }
.nav .grp .items a:hover { background:var(--hover); color:var(--ink); }
.nav .items a .hint { display:block; font-size:12px; color:var(--ink-3); font-weight:400; }
.userbox { display:flex; align-items:center; gap:10px; font-size:13px; }
.userbox a { color:var(--muted); text-decoration:none; }
.userbox a:hover { color:var(--ink); }
.userbox .name { color:var(--ink); font-weight:600; }
.userbox button { height:28px; padding:0 10px; background:var(--panel); border-color:var(--line-strong); color:var(--ink); font-size:13px; }
.userbox button:hover { background:var(--hover); border-color:var(--line-strong); }

main { padding:20px 24px 60px; max-width:1200px; margin:0 auto; }
.login { max-width:380px; margin:60px auto; }
.login h1 { font-size:20px; margin:0 0 6px; }
.apps { display:grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap:12px; }
.app { display:block; padding:14px 16px; border:1px solid var(--line); border-radius:8px; background:var(--panel);
  text-decoration:none; color:var(--ink); }
.app:hover { border-color:var(--accent); background:var(--hover); }
.app .n { font-weight:600; font-size:15px; }
.app .r { color:var(--muted); font-size:12px; margin-top:4px; }
.tabs { display:flex; gap:4px; margin-bottom:14px; border-bottom:1px solid var(--line); }
.tabs a { padding:8px 14px; text-decoration:none; color:var(--muted); border-bottom:2px solid transparent; }
.tabs a:hover { color:var(--ink); }
.tabs a.active { color:var(--accent); border-color:var(--accent); font-weight:600; }
.grid2 { display:grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap:16px; align-items:start; }
.brand, .nav .cat > a, .userbox a, .userbox .name { white-space:nowrap; }
@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
  header#top { flex-wrap:wrap; height:auto; min-height:52px; padding:0 12px; }
  .brand { margin-right:8px; }
  .nav { order:3; flex-basis:100%; height:44px; overflow-x:auto; overflow-y:visible; }
  .nav .cat > a { height:44px; padding:0 12px; font-size:14px; }
  .nav .panel { top:44px; min-width:280px; max-width:calc(100vw - 24px); }
  .userbox { margin-left:auto; gap:8px; }
  main { padding:14px 12px 40px; }
}
.toast { position:fixed; left:50%; bottom:28px; transform:translateX(-50%); background:var(--toast-bg); color:#fff;
  padding:10px 14px; border-radius:8px; box-shadow:var(--shadow-toast); z-index:50; max-width:80vw; }
.toast.err { background:var(--neg); }
/* 菜单页预览：分类竖排，每个分类下直接铺开它的分组与页面 */
.preview { border:1px solid var(--line); border-radius:8px; overflow:auto; background:var(--dark); }
.preview .nav { display:block; height:auto; padding:0; }
.preview .cat { display:block; }
.preview .cat > a { display:block; height:auto; padding:9px 14px; font-weight:600; background:var(--dark2);
  border-top:1px solid var(--divider); }
.preview .cat .panel { display:block; position:static; min-width:0; max-width:none; box-shadow:none; border-radius:0; padding:0 14px 6px; }
.preview .grp .items a { padding:5px 12px; }

/* 装在工作台里（?embed=1，app.js 给 <html> 加 .embed）：门户自己的顶栏和管理页签都藏掉——工作台的菜单、标签和侧栏就是它们；
   内容铺满嵌入窗、边距收紧，和工作台里别的程序页一个样子（2026-09-28 门户与工作台统一）。
   品牌色已统一为 --accent（Sowlab 绿），嵌入时不再单独改色（2026-09-30 令牌层统一）。 */
.embed header#top, .embed .tabs, .embed .foot { display:none; }
.embed body { background:var(--bg); }
.embed main { max-width:none; padding:16px 20px 32px; }

/* ---- 链接长成按钮（说明页的「返回首页」、「再试一次」）---- */
a.btn { display:inline-flex; align-items:center; justify-content:center; height:32px; padding:0 12px; border-radius:6px;
  border:1px solid var(--line-strong); background:var(--panel); color:var(--ink); text-decoration:none; font-weight:500;
  line-height:1; white-space:nowrap; }
a.btn:hover { background:var(--hover); }
a.btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
a.btn.primary:hover { background:var(--accent-hover); border-color:var(--accent-hover); }

/* ---- 页脚：品牌页脚文字 · 产品名 · 版本号 ---- */
.foot { text-align:center; color:var(--muted); font-size:12px; padding:0 16px 20px; }   /* 公司名、备案号、版本号是要让人看清的字，不用占位那一档弱色 */
.foot:empty { display:none; }

/* ---- 登录页（2026-10-02 重做）：只有标识、产品名和登录框，卡片在屏幕正中；不放任何经营信息 ---- */
body.at-login { min-height:100vh; display:flex; flex-direction:column; }
body.at-login header#top { display:none; }
body.at-login main { flex:1; width:100%; max-width:none; margin:0; padding:24px 16px; display:flex; align-items:center;
  justify-content:center; }
.signin-wrap { width:100%; max-width:360px; margin-bottom:6vh; }
.signin-brand { display:flex; flex-direction:column; align-items:center; gap:12px; margin-bottom:20px; }
.signin-brand img { width:40px; height:40px; display:block; }
.signin-brand h1 { margin:0; font-size:20px; font-weight:600; color:var(--ink); text-align:center; }
.signin { margin:0; padding:20px 20px 22px; }
.signin .field { margin-bottom:14px; }
.signin .field label { font-size:13px; }
.signin input[type=text], .signin input[type=password] { height:36px; }
.signin button[type=submit] { width:100%; height:36px; font-size:15px; }
.signin .err { margin-bottom:10px; }
.signin .err:empty { display:none; }
label.check { display:flex; align-items:center; gap:8px; margin:0 0 2px; font-size:13px; color:var(--ink); cursor:pointer; }
label.check input { margin:0; flex:0 0 auto; }
.check-note { margin:0 0 14px 21px; }   /* 勾选框下面那行说明，和勾选框的文字左对齐 */
.signin-hint { margin:14px 0 0; text-align:center; color:var(--muted); font-size:13px; }
.compat h1 { font-size:18px; margin:0 0 8px; }
.compat { max-width:520px; margin:60px auto; }

/* ---- 说明页（src/pages.js）：没有权限、应用不可用、页面不存在……原因 + 下一步 ---- */
body.notice-page { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:16px; }
.notice { width:100%; max-width:440px; margin-bottom:6vh; border:1px solid var(--line); border-radius:8px; padding:22px 24px 20px; }
.notice-brand { display:flex; align-items:center; gap:8px; margin-bottom:16px; color:var(--muted); font-size:13px; }
.notice-brand img { width:22px; height:22px; display:block; }
.notice h1 { margin:0 0 8px; font-size:18px; font-weight:600; }
.notice p { margin:0 0 6px; }
.notice p.notice-actions { margin:16px 0 0; }
/* 被工作台用 iframe 装着（notice.js 给 <html> 加 .framed）：不要品牌行和「返回首页」，也不要框线——外壳自己有标题和出路 */
.framed .notice-brand, .framed .notice-actions { display:none; }
.framed .notice { border:0; margin-bottom:0; }

/* 「请再输一次密码」对话框（第 2 批 L12）：规格照 docs/45 —— 宽 420、圆角 12、遮罩不模糊、标题 16/600、按钮靠右「取消 / 确认」 */
dialog.reauth { width:420px; max-width:calc(100vw - 32px); border:1px solid var(--line); border-radius:12px;
  padding:20px 22px; color:var(--ink); background:var(--panel); box-shadow:0 12px 40px rgba(15,15,15,.18); }
dialog.reauth::backdrop { background:rgba(15,15,15,.55); }
dialog.reauth h2 { margin:0 0 8px; font-size:16px; font-weight:600; }
dialog.reauth p { margin:0 0 12px; }
dialog.reauth .field { margin:14px 0 6px; }
dialog.reauth .reauth-err { margin:0 0 4px; min-height:18px; }
dialog.reauth .reauth-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:14px; }
dialog.reauth.access-conflict { width:760px; max-height:calc(100vh - 32px); overflow:auto; }
.access-diff { table-layout:fixed; width:100%; }
.access-diff th:first-child { width:24%; }
.access-diff td { background:var(--warn-bg, #FBECDD); overflow-wrap:anywhere; vertical-align:top; }
.access-conflict-body .small { margin-top:12px; }
@media (max-width:600px) {
  dialog.reauth.access-conflict { padding:16px 12px; }
  .access-diff th, .access-diff td { padding:10px 6px; font-size:13px; }
  dialog.access-conflict .reauth-actions button { width:100%; white-space:normal; }
}

/* 使用情况（热力图，2026-10-16） */
.usage-kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); gap:16px; }
.usage-kpi .big { font-size:36px; font-weight:700; line-height:1.1; margin-bottom:4px; }
.usage-kpi .big.warn { color:var(--warn); }
.usage-kpi table { margin-top:10px; }
.usage-bar { display:grid; grid-template-columns:minmax(90px,160px) 1fr 36px; align-items:center; gap:8px; font-size:13px; margin:5px 0; }
.usage-bar > span:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.usage-bar .track { display:block; height:10px; background:var(--neutral-soft); border-radius:3px; overflow:hidden; }
.usage-bar .track i { display:block; height:100%; background:var(--pos); }
.usage-bar b { text-align:right; font-weight:600; }
.usage-scroll { overflow-x:auto; }
.usage-heat { min-width:640px; }
.usage-heat th.c, .usage-heat td.c { text-align:center; width:48px; font-variant-numeric:tabular-nums; }
.usage-heat tr.grp td { font-weight:600; background:var(--paper-side); }
.heat.h0 { background:var(--neutral-soft); }
.heat.h1 { background:#DDEDEA; }
.heat.h2 { background:#B5D9CE; }
.heat.h3 { background:#7CBFA8; }
.heat.h4 { background:#448361; color:#fff; }
.usage-legend { display:flex; align-items:center; gap:4px; margin-bottom:8px; }
.usage-legend .heat { display:inline-block; width:18px; height:12px; border-radius:2px; }
