* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #eef2f7; color: #1e293b; font-size: 14px;
}
a { color: #2563eb; text-decoration: none; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1d4ed8 0%, #0ea5e9 100%);
}
.login-card {
  width: 380px; background: #fff; border-radius: 16px; padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .sub { color: #64748b; margin-bottom: 24px; }
.demo-accounts { margin-top: 20px; padding-top: 16px; border-top: 1px dashed #e2e8f0;
  font-size: 12px; color: #64748b; line-height: 1.9; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #0f172a; color: #cbd5e1; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .logo { padding: 20px 18px; font-size: 17px; font-weight: 700; color: #fff;
  border-bottom: 1px solid #1e293b; display:flex; align-items:center; gap:8px; }
.nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-group { padding: 14px 14px 6px; font-size: 11px; color: #64748b; letter-spacing: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 2px 0;
  border-radius: 8px; color: #cbd5e1; font-size: 14px;
}
.nav a:hover { background: #1e293b; color: #fff; }
.nav a.active { background: #2563eb; color: #fff; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.topbar .user { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #2563eb; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.content { padding: 24px; max-width: 1200px; width: 100%; margin: 0 auto; }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 18px; }

/* ---------- 组件 ---------- */
.card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 18px; }
.grid-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat { background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat .num { font-size: 28px; font-weight: 800; }
.stat .lbl { color: #64748b; margin-top: 4px; }
.stat.blue .num { color: #2563eb; } .stat.green .num { color: #16a34a; }
.stat.amber .num { color: #d97706; } .stat.slate .num { color: #475569; }
.stat-link { text-decoration: none; color: inherit; cursor: pointer;
  transition: transform .12s, box-shadow .12s; }
.stat-link:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.stat-link:active { transform: translateY(0); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer;
  font-size: 14px; background: #e2e8f0; color: #1e293b; transition: .15s;
}
.btn:hover { filter: brightness(.95); }
.btn-primary { background: #2563eb; color: #fff; }
.btn-success { background: #16a34a; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-ghost { background: #fff; border: 1px solid #e2e8f0; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: #64748b; padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.tbl td { padding: 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tbl tr:hover td { background: #f8fafc; }
.tbl .link { cursor: pointer; color: #2563eb; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.badge.running, .badge.pending { background: #dbeafe; color: #1d4ed8; }
.badge.approved, .badge.done { background: #dcfce7; color: #15803d; }
.badge.rejected { background: #fee2e2; color: #b91c1c; }
.badge.cancelled { background: #f1f5f9; color: #64748b; }
.badge.secret { background: #fef3c7; color: #b45309; }
.badge.internal { background: #e0f2fe; color: #0369a1; }
.badge.public { background: #f1f5f9; color: #475569; }
.badge.warn { background: #fef3c7; color: #b45309; }

.form-item { margin-bottom: 14px; }
.form-item label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.form-item label .req { color: #dc2626; margin-left: 2px; }
.form-item input, .form-item select, .form-item textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #d7dee8; border-radius: 8px;
  font-size: 14px; background: #fff; font-family: inherit;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
  outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-item textarea { min-height: 84px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }

.tpl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.tpl-card { background: #fff; border-radius: 12px; padding: 22px; text-align: center;
  cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: .15s; border: 2px solid transparent; }
.tpl-card:hover { border-color: #2563eb; transform: translateY(-2px); }
.tpl-card .ico { font-size: 32px; }
.tpl-card .nm { font-weight: 700; margin-top: 8px; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs .tab { padding: 7px 16px; border-radius: 8px; cursor: pointer; background: #fff;
  border: 1px solid #e2e8f0; color: #475569; }
.tabs .tab.active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: 640px; max-width: 96vw;
  max-height: 88vh; overflow-y: auto; padding: 24px; }
.modal h3 { font-size: 17px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.modal .close { cursor: pointer; color: #94a3b8; font-size: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* 时间线 */
.timeline { margin-top: 8px; }
.tl-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #f1f5f9; }
.tl-item:last-child { border-bottom: none; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; margin-top: 5px; flex-shrink: 0; }
.tl-item.done .tl-dot { background: #16a34a; }
.tl-item.pending .tl-dot { background: #2563eb; box-shadow: 0 0 0 4px #dbeafe; }
.tl-item.cancelled .tl-dot { background: #94a3b8; }
.tl-body { flex: 1; }
.tl-title { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tl-meta { color: #64748b; font-size: 12px; margin-top: 2px; }

.kv { display: grid; grid-template-columns: 130px 1fr; row-gap: 8px; margin: 8px 0; }
.kv .k { color: #64748b; }

.notif-item { display: flex; gap: 12px; padding: 14px 4px; border-bottom: 1px solid #f1f5f9; cursor: pointer; }
.notif-item:hover { background: #f8fafc; }
.notif-item.unread .t { font-weight: 700; }
.notif-item .dot { width: 8px; height: 8px; border-radius: 50%; background: #2563eb;
  margin-top: 6px; visibility: hidden; flex-shrink: 0; }
.notif-item.unread .dot { visibility: visible; }
.empty { text-align: center; color: #94a3b8; padding: 48px 0; }
.toast { position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 10px 22px; border-radius: 10px; z-index: 200;
  box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.toast.err { background: #dc2626; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.muted { color: #64748b; font-size: 12px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#menuBtn { display: none; }
.nav-mask { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 49; }

/* ================= 手机端自适应（≤768px） ================= */
@media (max-width: 768px) {
  #menuBtn { display: inline-flex; }
  .nav-mask.show { display: block; }
  .layout { display: block; }
  .sidebar { position: fixed; left: -240px; top: 0; z-index: 50;
    transition: left .25s ease; height: 100vh; }
  .sidebar.open { left: 0; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
  .main { min-width: 0; }
  .content { padding: 12px; }
  .page-title { font-size: 17px; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat .num { font-size: 22px; }
  .tpl-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .att-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl th, .tbl td { white-space: nowrap; }
  .modal { width: 96vw; padding: 16px; }
  .modal-actions { flex-wrap: wrap; }
  .login-card { width: min(380px, 92vw); }
  .chat-card { height: calc(100vh - 150px); }
  .chat-bubble { max-width: 88%; }
  .chat-input .btn { padding: 8px 10px; }
  .chat-input input { min-width: 0; }
  .clock-btns { flex-direction: column; }
  .att-time { font-size: 34px; }
  .kv { grid-template-columns: 96px 1fr; }
  .topbar .user span.muted { display: none; }
.data-card table { display: block; overflow-x: auto; }
}
/* ================= Mobile 专属界面（底部Tab壳） ================= */
.m-shell { display: flex; flex-direction: column; height: 100vh; max-width: 768px; margin: 0 auto; }
.m-header { min-height: 52px; background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
  color: #fff; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; position: sticky; top: 0; z-index: 10; }
.m-body { flex: 1; overflow-y: auto; padding: 12px 12px calc(76px + env(safe-area-inset-bottom)); }
.m-tabbar { position: fixed; bottom: 0; left: 0; right: 0; max-width: 768px; margin: 0 auto;
  height: calc(58px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid #e2e8f0; display: flex; z-index: 20; }
.m-tab { flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; font-size: 11px; color: #64748b; cursor: pointer; }
.m-tab .ico { font-size: 20px; line-height: 1; }
.m-tab.active { color: #2563eb; font-weight: 600; }
.m-card { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.m-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.m-app { display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 2px; border-radius: 10px; background: #f8fafc; font-size: 11px;
  color: #475569; cursor: pointer; text-align: center; }
.m-app:active { background: #eff6ff; }
.m-app .ico { font-size: 22px; }
.m-row { display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid #f1f5f9; gap: 10px; }
.m-row:last-child { border-bottom: none; }
.m-chip { flex: 1; background: #fff; border-radius: 10px; padding: 10px 6px;
  text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.m-chip .n { font-size: 18px; font-weight: 700; }
.m-chip .l { font-size: 11px; color: #64748b; }
.m-back { display: inline-flex; align-items: center; gap: 4px; color: #2563eb;
  font-size: 13px; margin-bottom: 10px; cursor: pointer; }
.m-shell .chat-card { height: auto; min-height: calc(100vh - 220px); }
.m-shell.m-chat .m-body { overflow: hidden; display: flex;
  padding: 0 10px calc(58px + env(safe-area-inset-bottom)) 10px; }
.m-shell.m-chat .chat-card { flex: 1; height: auto; min-height: 0;
  margin: 0; border-radius: 0; box-shadow: none; }
.m-shell.m-chat .page-title { display: none; }
.m-shell .chat-list { padding: 6px 4px; }
.chat-input .btn { flex-shrink: 0; }
.m-more-row { display: flex; align-items: center; gap: 12px; padding: 13px 4px;
  border-bottom: 1px solid #f1f5f9; cursor: pointer; font-size: 14px; }
.m-more-row .ico { font-size: 20px; }
.m-more-row .arr { margin-left: auto; color: #cbd5e1; }
/* ================= 左滑操作（Swipe Actions） ================= */
.swipe-wrap { position: relative; overflow: hidden; border-radius: 12px;
  margin-bottom: 10px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.swipe-actions { position: absolute; right: 0; top: 0; bottom: 0;
  display: flex; align-items: stretch; z-index: 0; }
.swipe-btn { display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-width: 64px; color: #fff; font-size: 13px;
  font-weight: 600; border: none; cursor: pointer; gap: 4px; }
.swipe-btn .bi { font-size: 18px; }
.swipe-btn.blue { background: #2563eb; }
.swipe-btn.red { background: #dc2626; }
.swipe-btn.green { background: #16a34a; }
.swipe-btn.orange { background: #d97706; }
.swipe-content { position: relative; z-index: 1; background: #fff;
  padding: 14px; transition: transform .2s ease; touch-action: pan-y;
  border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.swipe-hint { font-size: 10px; color: #94a3b8; text-align: right;
  padding: 2px 4px 0; }
.att-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 18px; margin-bottom: 18px; }
.att-clock-card { text-align: center; display: flex; flex-direction: column; justify-content: center; }
.att-date { color: #64748b; }
.att-time { font-size: 44px; font-weight: 800; letter-spacing: 2px; margin: 8px 0; font-variant-numeric: tabular-nums; }
.att-shift { margin-top: 6px; }
.loc-box { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px;
  padding: 14px; margin: 8px 0; line-height: 1.9; min-height: 64px; }
.clock-btns { display: flex; gap: 16px; }
.clock-btn { flex: 1; padding: 20px; font-size: 17px; font-weight: 700; border-radius: 12px; }
.clock-btn:disabled { opacity: .55; cursor: not-allowed; }
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 170px); min-height: 480px; }
.chat-list { flex: 1; overflow-y: auto; padding: 6px 4px; }
.chat-row { display: flex; margin: 10px 0; }
.chat-row.user { justify-content: flex-end; }
.chat-row.bot { flex-direction: column; align-items: flex-start; }
.chat-bubble { max-width: 78%; padding: 10px 14px; border-radius: 12px; line-height: 1.7; white-space: pre-wrap; }
.chat-bubble { overflow-wrap: anywhere; }
.chat-bubble.ub { background: #2563eb; color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble.ab { background: #f1f5f9; border-bottom-left-radius: 4px; }
.chat-meta { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.chat-src { margin-top: 6px; padding: 8px 12px; background: #fff; border: 1px solid #e2e8f0;
  border-radius: 8px; cursor: pointer; font-size: 13px; }
.chat-src:hover { border-color: #2563eb; }
.chat-suggest { padding: 8px 0; border-top: 1px dashed #e2e8f0; }
.chip { padding: 5px 12px; background: #fff; border: 1px solid #e2e8f0; border-radius: 999px;
  cursor: pointer; font-size: 13px; color: #475569; }
.chip:hover { border-color: #2563eb; color: #2563eb; }
.chip.on { border-color: #2563eb; color: #2563eb; background: #eff6ff; font-weight: 600; }
.llm-provider-card { position: relative; border: 2px solid #e2e8f0; border-radius: 12px;
  padding: 16px 14px; cursor: pointer; transition: all .15s; background: #fff; }
.llm-provider-card:hover { border-color: #93c5fd; transform: translateY(-1px); }
.llm-provider-card.active { border-color: #2563eb; background: #eff6ff; }
.chat-input { display: flex; gap: 10px; padding-top: 10px; border-top: 1px solid #e2e8f0; }
.chat-input input { flex: 1; padding: 11px 14px; border: 1px solid #d7dee8; border-radius: 10px; font-size: 14px; }
.chat-input input:focus { outline: none; border-color: #2563eb; }
.data-card table { margin: 10px 0; font-size: 12px; }
.data-card pre { background: #0f172a; color: #e2e8f0; padding: 10px; border-radius: 8px;
  font-size: 12px; overflow-x: auto; margin-top: 8px; }
.data-card details summary { cursor: pointer; margin-top: 8px; }
.img-chip { display: none; align-items: center; gap: 10px; padding: 8px 10px; margin: 0 0 8px;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; }
.img-chip img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.recording { animation: pulse 1s infinite; background: #fee2e2 !important; color: #dc2626 !important; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.4); } 50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); } }
.flow-card table { margin: 10px 0; font-size: 13px; }
.notif-item .t { white-space: pre-line; }
