/* ==========================================================================
   OnemanBiz ui.css · 共享样式（index.html / opc/index.html）
   职责：CSS 变量(明暗主题) + 布局 + 组件（按钮/语言菜单/卡片/tabs/kanban…）
   断点统一 ≤640px。
   ========================================================================== */

/* ---- 设计 token ---- */
:root {
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 12px 32px rgba(0,0,0,.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

[data-theme="light"] {
  --bg: #f7f8fa;
  --fg: #111827;
  --card: #ffffff;
  --border: #e5e7eb;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-2: #10b981;
  --accent-2-soft: #ecfdf5;
  --code: #f3f4f6;
}

[data-theme="dark"] {
  --bg: #0b1220;
  --fg: #e5e7eb;
  --card: #111a2c;
  --border: #24304a;
  --muted: #94a3b8;
  --accent: #818cf8;
  --accent-soft: #1e2447;
  --accent-2: #34d399;
  --accent-2-soft: #0f2b22;
  --code: #16203a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  transition: background .2s, color .2s;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ===== 公共头部 ===== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.logo .logo-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 800; }
.logo .logo-sub { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.header-actions { display: flex; align-items: center; gap: 10px; }

/* ===== 按钮（theme / lang）===== */
.theme-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: border-color .15s;
  min-height: 36px;
}
.theme-btn:hover { border-color: var(--accent); }
.theme-btn svg { width: 14px; height: 14px; stroke: currentColor; flex-shrink: 0; }

.lang-wrap { position: relative; }
.lang-btn-ico { width: 14px; height: 14px; stroke: currentColor; flex-shrink: 0; }
.lang-cur { min-width: 22px; text-align: center; font-weight: 600; }
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px;
  min-width: 158px;
  display: none;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-md);
  z-index: 50;
}
[data-theme="dark"] .lang-menu { box-shadow: 0 12px 32px rgba(0,0,0,.55); }
.lang-menu.open { display: flex; }
.lang-opt {
  display: flex; align-items: center; gap: 8px; width: 100%;
  text-align: start; background: none; border: none; color: var(--fg);
  font-size: 13px; padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font);
}
.lang-opt:hover { background: var(--accent-soft); }
.lang-opt.active { font-weight: 600; color: var(--accent); }

/* ===== 首页 hero ===== */
.hero { padding: 72px 0 48px; text-align: center; }
.hero .badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12.5px; font-weight: 600; letter-spacing: .05em;
  padding: 6px 14px; border-radius: 999px; margin-bottom: 24px;
}
.hero h1 { font-size: clamp(30px, 5vw, 48px); line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; }
.hero h1 .grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { max-width: 640px; margin: 20px auto 32px; color: var(--muted); font-size: 16.5px; }
.cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border); color: var(--fg);
  padding: 11px 22px; border-radius: var(--radius-md); font-size: 14.5px; font-weight: 600;
  cursor: pointer; transition: all .15s; font-family: var(--font);
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn .arr { transition: transform .15s; }
.btn:hover .arr { transform: translateX(3px); }

/* metrics */
.metrics { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin: 48px 0 8px; }
.metric {
  min-width: 140px; padding: 18px 22px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.metric .num { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; color: var(--accent); }
.metric .lbl { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.metric .sub { font-size: 11px; color: var(--muted); opacity: .8; }

/* 区块通用 */
.section { padding: 64px 0; border-top: 1px solid var(--border); }
.section-title { font-size: clamp(24px, 4vw, 32px); font-weight: 800; text-align: center; letter-spacing: -0.02em; }
.section-sub { text-align: center; color: var(--muted); margin-top: 10px; font-size: 15px; }

/* team */
.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 36px; }
.member {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; transition: all .15s; box-shadow: var(--shadow-sm);
}
.member:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.m-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 16px;
}
.m-name { font-size: 15px; font-weight: 700; }
.m-en { font-size: 12px; color: var(--muted); }
.m-cap { font-size: 13px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.m-role { font-size: 12.5px; color: var(--accent); font-weight: 600; margin-top: 4px; }

/* mech */
.mech { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-top: 36px; }
.mech-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-sm);
}
.mech-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.mech-card h3 .k { width: 22px; height: 22px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.item:last-child { border-bottom: none; }
.item .v { color: var(--accent-2); font-weight: 600; font-size: 13px; white-space: nowrap; }

/* values */
.values { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 32px; }
.val-chip {
  background: var(--card); border: 1px solid var(--border); color: var(--fg);
  padding: 9px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
}
.val-chip:nth-child(odd) { border-color: var(--accent); color: var(--accent); }

/* edge */
.edge { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-top: 36px; }
.edge-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.edge-card .idx {
  font-size: 13px; font-weight: 800; color: var(--accent); letter-spacing: .08em;
  border: 1px solid var(--accent); border-radius: 8px; padding: 2px 8px; display: inline-block; margin-bottom: 12px;
}
.edge-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.edge-card p { font-size: 13.5px; color: var(--muted); }

/* works */
.works-pane {
  margin-top: 36px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; text-align: center; box-shadow: var(--shadow-sm);
}
.works-pane p { max-width: 560px; margin: 12px auto 0; color: var(--muted); }

/* footer */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0 48px; text-align: center; color: var(--muted); font-size: 13px; }

/* ===== 动画 ===== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.anim { animation: fadeUp .5s ease both; }

/* ===== 透明办公室 ===== */
.opc-wrap { padding: 24px 0 64px; }
.conn-bar {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  font-size: 12px; color: var(--muted); padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 20px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); display: inline-block; }
.dot.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.server-clock { font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab-btn {
  background: none; border: none; color: var(--muted); font-size: 14px; font-weight: 600;
  padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; font-family: var(--font);
}
.tab-btn:hover { color: var(--fg); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeUp .3s ease both; }

.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.panel-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: space-between;
}
.panel-head .hint { color: var(--muted); font-weight: 400; font-size: 12px; }
.panel-body { padding: 18px; }

/* office tab: members + feed */
.office-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 860px) { .office-grid { grid-template-columns: 1fr; } }

.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }

/* 办公室视觉（AI 生成平面图 + 成员头像覆盖层） */
.office-visual { position: relative; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); margin-bottom: 14px; }
.office-img { width: 100%; height: auto; display: block; }
#memberStatus { position: absolute; inset: 0; }
.m-avatar {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px; z-index: 2;
  cursor: pointer;
}
.m-avatar .avatar-img {
  width: 46px; height: 46px; border-radius: 50%;
  border: 2.5px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.18);
  object-fit: cover; background: var(--card);
}
[data-theme="dark"] .m-avatar .avatar-img { border-color: #24304a; }
.m-avatar .dot {
  position: absolute; top: -1px; right: -1px;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
[data-theme="dark"] .m-avatar .dot { border-color: #24304a; }
.m-avatar .dot.active { background: #10b981; }
.m-avatar .dot.working { background: #3b82f6; }
.m-avatar .dot.waiting { background: #f59e0b; }
.m-avatar .dot.blocked { background: #dc2626; }
.m-avatar .dot.idle { background: #9ca3af; }
/* 图例（office-legend）状态灯颜色，与成员头像一致 */
.office-legend .dot.active { background: #10b981; }
.office-legend .dot.working { background: #3b82f6; }
.office-legend .dot.waiting { background: #f59e0b; }
.office-legend .dot.blocked { background: #dc2626; }
.office-legend .dot.idle { background: #9ca3af; }
.m-avatar .nm {
  font-size: 10.5px; font-weight: 600; white-space: nowrap;
  background: rgba(255,255,255,.9); color: #111827;
  padding: 1px 7px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
[data-theme="dark"] .m-avatar .nm { background: rgba(17,26,44,.9); color: #e5e7eb; }
@media (max-width: 640px) {
  .m-avatar .avatar-img { width: 34px; height: 34px; }
  .m-avatar .nm { font-size: 9px; }
}
.m-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px; transition: all .15s;
}
.m-card:hover { border-color: var(--accent); }
.m-card .top { display: flex; align-items: center; gap: 10px; }
.m-card .nm { font-size: 13.5px; font-weight: 700; }
.m-card .rl { font-size: 11px; color: var(--muted); }
.m-card .act { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.45; }
.m-card .st { font-size: 11px; margin-top: 8px; display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; }
.st.idle { background: var(--code); color: var(--muted); }
.st.active { background: var(--accent-2-soft); color: var(--accent-2); }
.st.blocked { background: #fef2f2; color: #dc2626; }
[data-theme="dark"] .st.blocked { background: #3a1d22; color: #f87171; }
.st.done { background: var(--accent-soft); color: var(--accent); }

.feed { display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow-y: auto; }
.feed-item {
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px;
  font-size: 13px; display: flex; gap: 10px; align-items: flex-start;
}
.feed-item .who { font-weight: 700; font-size: 12px; white-space: nowrap; }
.feed-item .act-badge { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; white-space: nowrap; font-weight: 700; }
.act-badge.work { background: var(--accent-soft); color: var(--accent); }
.act-badge.done { background: var(--accent-2-soft); color: var(--accent-2); }
.act-badge.meet { background: var(--code); color: var(--muted); }
.act-badge.talk { background: #fef9c3; color: #a16207; }
[data-theme="dark"] .act-badge.talk { background: #3a3410; color: #facc15; }
.feed-item .body { flex: 1; }
.feed-item .detail { color: var(--muted); }
.feed-item .ts { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* kanban */
.kb-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; min-width: 640px; }
@media (max-width: 860px) { .kb-cols { min-width: 0; grid-template-columns: 1fr 1fr; } }
.kb-col { background: var(--code); border-radius: var(--radius-md); padding: 10px; min-height: 120px; }
.kb-col-head { font-size: 12.5px; font-weight: 700; padding: 4px 6px 10px; display: flex; justify-content: space-between; }
.kb-col-head .cnt { color: var(--muted); font-weight: 400; }
.kb-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 8px; font-size: 12.5px; box-shadow: var(--shadow-sm);
}
.kb-card .tt { font-weight: 600; line-height: 1.4; }
.kb-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 11px; color: var(--muted); }
.kb-card .asg { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 1px 8px; font-weight: 600; }
.kb-card .acc { margin-top: 8px; font-size: 11.5px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 6px; }

/* gateway */
.gw-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 860px) { .gw-row { grid-template-columns: 1fr; } }
.gw-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; }
.gw-card .nm { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.gw-card .hl { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.gw-card .hl.ok { background: var(--accent-2); }
.gw-card .hl.bad { background: #dc2626; }
.gw-card .kv { font-size: 12.5px; color: var(--muted); margin-top: 10px; display: flex; justify-content: space-between; }
.gw-card .kv b { color: var(--fg); font-variant-numeric: tabular-nums; }

/* 产出列表 */
.art-card { border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 12px; overflow: hidden; }
.art-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--code); border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.art-dir { color: var(--accent); font-weight: 700; font-size: 11px; background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
.art-file { font-weight: 600; word-break: break-all; }
.art-meta { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.art-preview {
  margin: 0; padding: 12px 14px; font-size: 12px; line-height: 1.6;
  color: var(--muted); white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow-y: auto;
  background: var(--card); font-family: var(--font);
}

/* 占位提示 */
.empty-hint { color: var(--muted); font-size: 13px; text-align: center; padding: 28px 12px; }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }

/* 隐藏（i18n 门控用） */
html.i18n-pending [data-i18n] { visibility: hidden; }

@media (max-width: 640px) {
  .theme-btn .theme-txt { display: none; }
  .container { padding: 0 16px; }
  .hero { padding: 48px 0 32px; }
  .section { padding: 48px 0; }
  .metric { min-width: 120px; padding: 14px 16px; }
  .metric .num { font-size: 24px; }
  .mech, .edge { grid-template-columns: 1fr; }
}
