/* ==========================================================================
   润泽酒窖工作台 · 样式表
   重写版：覆盖全部页面与组件
   ========================================================================== */

:root{
  --sidebar:#0f172a; --sidebar-2:#1a2437; --sidebar-3:#243147;
  --bg:#f5f6f8; --card:#fff; --ink:#0f172a; --muted:#64748b;
  --line:#e5e8ee; --brand:#2563eb; --brand-soft:#eef4ff;
  --ok:#16803c; --ok-soft:#e9f7ef; --warn:#b45309; --warn-soft:#fdf3e3;
  --err:#c0272d; --err-soft:#fdecec; --radius:12px;
}

*{box-sizing:border-box}
[hidden]{display:none !important}
html,body{height:100%}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei","PingFang SC",sans-serif;
  font-size:14px; line-height:1.6; -webkit-font-smoothing:antialiased;
}
a{color:var(--brand); text-decoration:none}
h1,h2,h3,h4{margin:0}

/* ---------------- 登录 ---------------- */
.login-mask{
  position:fixed; inset:0; z-index:200; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(160deg,#0f172a,#1e3a8a); padding:20px;
}
.login-card{
  width:100%; max-width:380px; background:#fff; border-radius:16px; padding:32px 28px;
  box-shadow:0 24px 60px rgba(2,6,23,.35);
}
.login-brand{
  width:64px; height:64px; border-radius:16px; margin:0 auto 16px; position:relative; overflow:hidden;
  background:linear-gradient(135deg,#3b82f6,#8b5cf6); color:#fff;
  display:flex; align-items:center; justify-content:center; font-size:26px; font-weight:700;
}
.login-brand img{position:absolute; inset:0; width:100%; height:100%; object-fit:contain; padding:4px}
.login-card h2{text-align:center; font-size:20px; margin-bottom:4px}
.login-sub{text-align:center; color:var(--muted); font-size:13px; margin:0 0 22px}
.login-err{color:var(--err); font-size:12.5px; margin-top:10px; min-height:18px; text-align:center}

/* ---------------- 骨架 ---------------- */
.app{display:flex; height:100vh; overflow:hidden}

.sidebar{
  width:216px; flex:0 0 216px; background:var(--sidebar); color:#cbd5e1;
  display:flex; flex-direction:column; overflow:hidden;
}
.brand{display:flex; align-items:center; gap:10px; padding:18px 16px 14px}
.brand-mark{
  width:36px; height:36px; border-radius:10px; flex:0 0 36px; overflow:hidden; position:relative;
  background:linear-gradient(135deg,#3b82f6,#8b5cf6); color:#fff; font-weight:700;
  display:flex; align-items:center; justify-content:center; font-size:18px;
}
.brand-mark img{position:absolute; inset:0; width:100%; height:100%; object-fit:contain; padding:1px}
.brand-text{min-width:0}
.brand-name{font-size:14px; font-weight:650; color:#f1f5f9; line-height:1.3}
.brand-sub{font-size:11px; color:#64748b; line-height:1.3}

#nav{flex:1; overflow-y:auto; padding:6px 8px}
.nav-item{
  display:flex; align-items:center; gap:10px; padding:9px 12px; margin-bottom:2px;
  border-radius:9px; color:#94a3b8; font-size:13px; cursor:pointer; user-select:none;
  transition:background .12s, color .12s;
}
.nav-item:hover{background:var(--sidebar-2); color:#e2e8f0}
.nav-item.active{background:var(--sidebar-3); color:#fff; font-weight:600}
.nav-item i{
  font-style:normal; width:18px; height:18px; display:flex; align-items:center;
  justify-content:center; opacity:.8; flex:0 0 18px;
}
.nav-item i svg{width:17px; height:17px}
.nav-item span{flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.nav-item .dot{
  width:7px; height:7px; border-radius:50%; background:#f97316; flex:0 0 7px;
}

.side-foot{padding:12px 16px 16px; border-top:1px solid #1e293b}
.mode-pill{
  display:inline-block; font-size:11px; padding:3px 9px; border-radius:999px;
  background:#132a1f; color:#4ade80; margin-bottom:8px;
}
.mode-pill.mock{background:#3b2a12; color:#fbbf24}
.ver{font-size:10.5px; color:#475569; line-height:1.5}

.main{flex:1; display:flex; flex-direction:column; min-width:0; overflow:hidden}
.topbar{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:14px 24px; background:#fff; border-bottom:1px solid var(--line); flex:0 0 auto;
}
.topbar h1{font-size:17px; font-weight:650}
.topbar .sub{margin:2px 0 0; font-size:12.5px; color:var(--muted)}
.top-actions{display:flex; align-items:center; gap:12px}

.icon-btn{
  border:1px solid var(--line); background:#fff; border-radius:9px; width:36px; height:36px;
  cursor:pointer; font-size:15px; position:relative; display:flex; align-items:center;
  justify-content:center; color:#475569;
}
.icon-btn:hover{border-color:#cbd5e1}
.badge{
  position:absolute; top:-3px; right:-3px; min-width:16px; height:16px; padding:0 4px;
  border-radius:9px; background:#ef4444; color:#fff; font-size:10px; line-height:16px;
  text-align:center; font-weight:600;
}

.user-chip{
  position:relative; display:flex; align-items:center; gap:8px; padding:5px 10px;
  border:1px solid var(--line); border-radius:999px; cursor:pointer; font-size:13px;
  background:#fff; user-select:none;
}
.user-chip:hover{border-color:#cbd5e1}
.avatar-sm{
  width:26px; height:26px; border-radius:50%; background:var(--brand-soft); color:var(--brand);
  display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:650;
  flex:0 0 26px;
}
.user-chip .caret{font-size:10px; color:var(--muted)}
.user-menu{
  position:absolute; top:calc(100% + 8px); right:0; min-width:170px; background:#fff;
  border:1px solid var(--line); border-radius:10px; box-shadow:0 12px 30px rgba(15,23,42,.12);
  padding:6px; z-index:60;
}
.um-head{padding:8px 10px; font-size:12px; color:var(--muted); border-bottom:1px solid var(--line); margin-bottom:4px}
.user-menu a{display:block; padding:8px 10px; border-radius:7px; color:#334155; font-size:13px; cursor:pointer}
.user-menu a:hover{background:#f5f7fa}

.content{flex:1; overflow-y:auto; padding:20px 24px 40px}
.page{display:none}
.page.active{display:block}

/* ---------------- 通用组件 ---------------- */
.card{
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  padding:18px; margin-bottom:16px;
}
.card-head{
  display:flex; align-items:center; gap:8px; font-size:14px; font-weight:650;
  margin-bottom:14px; color:#0f172a;
}
.section-title{
  font-size:13px; font-weight:650; color:#334155; margin:20px 0 10px;
  display:flex; align-items:center; gap:8px;
}
.row{display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; margin-top:12px}
.field{flex:1; min-width:170px}
.field-label{display:block; font-size:12px; color:#475569; margin-bottom:5px; font-weight:500}
.hint{font-size:12px; color:var(--muted); margin:8px 0 0; line-height:1.6}
.empty-line{color:var(--muted); font-size:13px; padding:22px 4px; text-align:center}

input[type=text],input[type=password],input[type=number],input:not([type]),select,textarea{
  width:100%; border:1px solid var(--line); border-radius:9px; padding:9px 11px;
  font-size:13px; font-family:inherit; color:var(--ink); background:#fff; outline:none;
  transition:border-color .12s, box-shadow .12s;
}
input:focus,select:focus,textarea:focus{
  border-color:#93b4fb; box-shadow:0 0 0 3px rgba(37,99,235,.12);
}
textarea{resize:vertical; line-height:1.65}
select{cursor:pointer; appearance:none; background-image:linear-gradient(45deg,transparent 50%,#94a3b8 50%),linear-gradient(135deg,#94a3b8 50%,transparent 50%); background-position:calc(100% - 16px) 50%,calc(100% - 11px) 50%; background-size:5px 5px,5px 5px; background-repeat:no-repeat; padding-right:30px}
.check{display:flex; align-items:center; gap:8px; font-size:13px; color:#334155; margin-top:10px; cursor:pointer}
.check input{width:auto}

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  border:1px solid var(--line); background:#fff; color:#334155; border-radius:9px;
  padding:9px 16px; font-size:13px; font-family:inherit; cursor:pointer;
  transition:background .12s, border-color .12s, transform .06s; white-space:nowrap;
}
.btn:hover{background:#f7f9fc; border-color:#cbd5e1}
.btn:active{transform:translateY(1px)}
.btn:disabled{opacity:.55; cursor:not-allowed}
.btn.primary{background:var(--brand); border-color:var(--brand); color:#fff; font-weight:600}
.btn.primary:hover{background:#1d4ed8; border-color:#1d4ed8}
.btn.ghost{background:#fff}
.btn.small{padding:6px 12px; font-size:12px; border-radius:8px}
.btn.tiny{padding:4px 9px; font-size:11.5px; border-radius:7px}
.btn.block{width:100%; margin-top:16px; padding:11px}
.btn.ghost.small.on{background:var(--brand-soft); border-color:#bcd0fb; color:var(--brand); font-weight:600}
.btn.table-export{
  display:block; margin:10px 0 6px; background:#eef4ff; border-color:#cfdffb;
  color:#1d4ed8; font-weight:600;
}
.btn.table-export:hover{background:#e2ecff}

.tag{
  display:inline-flex; align-items:center; font-size:11px; padding:2px 8px; border-radius:999px;
  background:#eef1f6; color:#475569; font-weight:500;
}
.tag.ok{background:var(--ok-soft); color:var(--ok)}
.tag.warn{background:var(--warn-soft); color:var(--warn)}
.tag.err,.tag.bad{background:var(--err-soft); color:var(--err)}
.chip{
  display:inline-flex; align-items:center; gap:6px; font-size:11.5px; padding:3px 9px;
  border-radius:999px; background:#eef1f6; color:#475569;
}
.chips{display:flex; gap:6px; flex-wrap:wrap}

/* ---------------- 标签页 ---------------- */
.tabs{display:flex; gap:4px; border-bottom:1px solid var(--line); margin:16px 0 14px}
.tab{
  border:none; background:none; padding:9px 14px; font-size:13px; color:var(--muted);
  cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px; font-family:inherit;
}
.tab:hover{color:#334155}
.tab.active{color:var(--brand); border-bottom-color:var(--brand); font-weight:600}

/* ---------------- 拖放区 ---------------- */
.dropzone{
  border:1.5px dashed #cbd5e1; border-radius:12px; padding:26px 20px; text-align:center;
  background:#fafcff; cursor:pointer; transition:border-color .15s, background .15s;
}
.dropzone:hover,.dropzone.over{border-color:var(--brand); background:#f2f7ff}
.dz-ico{
  width:38px; height:38px; margin:0 auto 10px; border-radius:50%; background:var(--brand-soft);
  color:var(--brand); display:flex; align-items:center; justify-content:center; font-size:17px;
}
.dz-main{font-size:13.5px; font-weight:600; color:#334155}
.dz-sub{font-size:12px; color:var(--muted); margin-top:4px}

.progress{margin-top:14px}
.progress .track{height:7px; background:#eef1f6; border-radius:999px; overflow:hidden}
.progress .fill{height:100%; width:0; background:var(--brand); border-radius:999px; transition:width .2s}
.progress .lab{display:flex; justify-content:space-between; font-size:11.5px; color:var(--muted); margin-top:6px}

/* ---------------- 统计卡片 ---------------- */
.stat-row{display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; margin-bottom:8px}
.stat{background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:14px 16px}
.stat .k{font-size:12px; color:var(--muted); margin-bottom:4px}
.stat .v{font-size:19px; font-weight:650; color:#0f172a}

/* ---------------- 任务卡片 ---------------- */
.task-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:12px}
.task-card{
  background:#fff; border:1px solid var(--line); border-radius:var(--radius); padding:15px;
  cursor:pointer; transition:border-color .15s, box-shadow .15s, transform .15s;
}
.task-card:hover{border-color:#b9cdf7; box-shadow:0 8px 20px rgba(15,23,42,.07); transform:translateY(-1px)}
.task-card.off{opacity:.55; cursor:not-allowed}
.task-card .ico{height:34px; display:flex; align-items:center}
.task-card .ico img{height:34px; width:auto; max-width:52px; object-fit:contain}
.task-card .ico svg{width:24px; height:24px; color:var(--brand)}
.task-card .ico-fb{display:flex; align-items:center}
.task-card .t{font-size:14px; font-weight:650; margin:6px 0 2px}
.task-card .d{font-size:12px; color:var(--muted); line-height:1.55}
.task-card .m{font-size:11px; color:#94a3b8; margin-top:8px}
.note-card{color:#475569; font-size:13px; line-height:1.75}

/* ---------------- 对话 ---------------- */
.chat-card{display:flex; flex-direction:column; min-height:calc(100vh - 150px)}
.chat-head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding-bottom:12px; border-bottom:1px solid var(--line); margin-bottom:12px;
}
.chat-body{flex:1; overflow-y:auto; padding:6px 2px; min-height:280px}
.chat-empty{color:var(--muted); text-align:center; padding:60px 0; font-size:13px; line-height:2}

.msg{display:flex; gap:10px; margin-bottom:16px; align-items:flex-start}
.msg.user{flex-direction:row-reverse}
.avatar{
  width:30px; height:30px; border-radius:50%; flex:0 0 30px; display:flex; align-items:center;
  justify-content:center; font-size:11.5px; font-weight:650; background:#eef1f6; color:#475569;
}
.msg.user .avatar{background:var(--brand); color:#fff}
.bubble{
  max-width:88%; background:#f4f6fa; border:1px solid var(--line); border-radius:12px;
  border-top-left-radius:4px; padding:11px 14px; font-size:13.5px; line-height:1.75;
  white-space:pre-wrap; word-break:break-word; overflow-x:auto;
}
.msg.user .bubble{
  background:var(--brand); border-color:var(--brand); color:#fff; border-top-left-radius:12px;
  border-top-right-radius:4px;
}
.msg.bot{max-width:100%}
.caret{display:inline-block; width:7px; height:14px; background:var(--brand); vertical-align:-2px; animation:blink 1s steps(2) infinite}
@keyframes blink{50%{opacity:0}}

.chat-mats{display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:10px 0; border-top:1px solid var(--line)}
.chat-input{display:flex; gap:10px; align-items:flex-end; padding-top:10px}
.chat-input textarea{flex:1; min-height:48px}
.chat-input .btn{height:44px}

/* 表格 */
.md-table{
  white-space:normal; overflow:auto; margin:10px 0;
  border:1px solid #e4e9f0; border-radius:10px; background:#fff; position:relative;
}
.bubble .md-table table{
  width:100%; min-width:620px; table-layout:fixed; border-collapse:collapse;
  font-size:13px; background:#fff;
}
.bubble th,.bubble td{
  padding:10px 13px; text-align:left; vertical-align:top; word-break:break-word;
  white-space:normal; line-height:1.68; border-bottom:1px solid #eef1f6;
}
.bubble th{background:#f5f8fc; font-weight:650; color:#334155; border-bottom:1px solid #dfe6f0}
.bubble tbody tr:last-child td{border-bottom:none}
.bubble tbody tr:nth-child(even){background:#fbfcfe}
.bubble th:nth-child(1),.bubble td:nth-child(1){width:12%}
.bubble th:nth-child(2),.bubble td:nth-child(2){width:22%}
.bubble th:nth-child(3),.bubble td:nth-child(3){width:28%}
.bubble th:nth-child(4),.bubble td:nth-child(4){width:21%}
.bubble th:nth-child(5),.bubble td:nth-child(5){width:17%}
.bubble code{background:#eef1f6; padding:1px 5px; border-radius:4px; font-size:12px; font-family:ui-monospace,Consolas,monospace}
.bubble strong{font-weight:650}
.md-h{margin:16px 0 8px; font-weight:700; line-height:1.4; color:#0f172a}
h2.md-h{font-size:16px}
h3.md-h{font-size:14.5px}
h4.md-h{font-size:13.5px; color:#334155}

/* ---------------- 快捷提示词 ---------------- */
.prompt-bar{border-top:1px solid var(--line); margin-top:10px; padding-top:10px}
.pb-head{display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:8px}
.pb-label{font-size:12px; font-weight:600; color:#475569; flex:0 0 auto}
.pb-chips{display:flex; gap:6px; flex-wrap:wrap; flex:1; min-width:0}
.pb-chip{
  border:1px solid var(--line); background:#fff; color:#475569; cursor:pointer;
  font-size:11.5px; padding:4px 10px; border-radius:999px; line-height:1.6; font-family:inherit;
}
.pb-chip:hover{border-color:#c3d3f5; background:#f7f9ff}
.pb-chip.active{background:var(--brand-soft); border-color:#b9cdf7; color:var(--brand); font-weight:600}
.pb-toggle{border:none; background:none; color:var(--muted); font-size:11.5px; cursor:pointer; padding:3px 5px; font-family:inherit}
.pb-toggle:hover{color:var(--brand)}
.pb-cards{display:grid; grid-template-columns:repeat(3,1fr); gap:8px}
.pb-empty{grid-column:1/-1; font-size:12px; color:var(--muted); padding:8px 0}
@media (max-width:900px){ .pb-cards{grid-template-columns:1fr} }

.prompt-card{
  border:1px solid var(--line); border-radius:10px; padding:10px 12px; cursor:pointer;
  background:#fff; transition:border-color .15s, box-shadow .15s, transform .15s; position:relative;
}
.prompt-card:hover{border-color:#b9cdf7; box-shadow:0 6px 16px rgba(15,23,42,.07); transform:translateY(-1px)}
.pc-title{font-weight:600; font-size:12.5px; margin-bottom:4px; display:flex; align-items:center; gap:6px}
.pc-preview{
  font-size:11.5px; color:#64748b; line-height:1.55; display:-webkit-box;
  -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.pc-tag{background:var(--brand-soft); color:var(--brand); font-size:10px; padding:1px 5px; border-radius:4px; font-weight:500}
.pc-del{margin-left:auto; border:none; background:none; color:#94a3b8; cursor:pointer; font-size:12px; padding:0 2px; line-height:1}
.pc-del:hover{color:#dc2626}
.prompt-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:10px}

/* ---------------- 素材库 ---------------- */
.mat-stats{
  display:flex; align-items:center; gap:14px; flex-wrap:wrap; font-size:12px;
  color:var(--muted); margin-bottom:12px;
}
.mst b{color:#0f172a; font-size:14px; margin-right:2px}
.top-list{display:flex; gap:8px; flex-wrap:wrap}
.top-item{background:#f4f6fa; border-radius:999px; padding:2px 9px; font-size:11.5px; color:#475569}
.top-item b{font-weight:600}

.mat-crumb{display:flex; align-items:center; gap:8px; font-size:13px; margin-bottom:12px}
.mat-crumb a{color:var(--brand); cursor:pointer}
.mat-crumb a:hover{text-decoration:underline}
.mat-crumb .sep{color:#cbd5e1}
.mat-crumb b{color:var(--ink)}

.folder-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:12px}
.folder-card{
  border:1px solid var(--line); border-radius:12px; padding:12px; background:#fff;
  cursor:pointer; transition:border-color .15s, box-shadow .15s, transform .15s;
}
.folder-card:hover{border-color:#b9cdf7; box-shadow:0 6px 18px rgba(15,23,42,.08); transform:translateY(-2px)}
.folder-thumb{
  height:96px; border-radius:9px; background:#f4f6fa; display:flex; align-items:center;
  justify-content:center; overflow:hidden; margin-bottom:10px;
}
.folder-thumb img{max-height:96px; max-width:100%; object-fit:contain}
.folder-emoji{font-size:26px; color:#b6c2d4}
.folder-name{font-weight:650; font-size:13.5px; margin-bottom:2px; color:#0f172a}
.folder-meta{font-size:11.5px; color:var(--muted)}

.list{display:flex; flex-direction:column}
.mat-row{
  display:flex; gap:12px; padding:14px 4px; border-bottom:1px solid #f0f2f6; align-items:flex-start;
}
.mat-row:last-child{border-bottom:none}
.mat-ico{
  width:40px; height:40px; flex:0 0 40px; border-radius:9px; background:#f4f6fa; color:#64748b;
  display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:650;
  letter-spacing:.3px;
}
.mat-main{flex:1; min-width:0}
.mat-title{font-size:13.5px; font-weight:600; display:flex; align-items:center; gap:6px; flex-wrap:wrap}
.mat-sub{font-size:11.5px; color:var(--muted); margin-top:3px; display:flex; gap:6px; align-items:center; flex-wrap:wrap}
.chip-type{background:#eef1f6; color:#475569; padding:1px 7px; border-radius:5px; font-size:11px}
.vbadge{background:var(--brand-soft); color:var(--brand); font-size:10.5px; padding:1px 6px; border-radius:5px; font-weight:600}
.mat-preview{
  font-size:12px; color:#94a3b8; margin-top:5px; overflow:hidden; text-overflow:ellipsis;
  white-space:nowrap;
}
.mat-side{display:flex; gap:6px; flex-wrap:wrap; align-items:flex-start; justify-content:flex-end; flex:0 0 auto}

.pick-row{display:flex; align-items:center; gap:10px; padding:10px 6px; border-bottom:1px solid #f0f2f6; cursor:pointer}
.pick-row:hover{background:#fafbfe}
.pick-row input{width:auto; flex:0 0 auto}
.pick-row .pm{flex:1; min-width:0}
.pick-row .pm .t{font-size:13px; font-weight:600; color:#0f172a}
.pick-row .pm .s{font-size:11.5px; color:var(--muted); margin-top:2px}

.tiny{font-size:11.5px; color:#94a3b8}

.filters{gap:10px; margin-bottom:12px}

/* ---------------- 列表 / 评论 ---------------- */
.list-row{
  display:flex; align-items:flex-start; gap:12px; padding:14px 4px;
  border-bottom:1px solid #f0f2f6; cursor:pointer; border-radius:8px;
  transition:background .12s;
}
.list-row:hover{background:#f8fafd}
.list-row:last-child{border-bottom:none}
.list-row .when{font-size:11.5px; color:var(--muted); flex:0 0 128px; line-height:1.7}
.list-row .what{flex:1; min-width:0; font-size:13px; line-height:1.65; word-break:break-word}
.list-row .meta{font-size:11.5px; color:var(--muted); display:flex; gap:8px; flex-wrap:wrap; margin-top:4px}
.list-row .cost{font-size:12px; color:#475569; flex:0 0 auto}

.comment-item{border:1px solid var(--line); border-radius:10px; padding:12px 14px; margin-bottom:10px; background:#fbfcfe}
.comment-item .tc{font-size:11.5px; color:var(--brand); font-weight:600}
.comment-item .body{font-size:13px; margin:4px 0}
.comment-item .advice{font-size:12.5px; color:#475569; background:#fff; border-left:3px solid var(--brand); padding:6px 10px; border-radius:4px}
.comment-item .who{font-size:11px; color:var(--muted); margin-top:6px}
.comment-list{max-height:34vh; overflow-y:auto; margin-bottom:12px}
.comment-form{border-top:1px dashed var(--line); padding-top:12px}

.revision-box{background:#f0fdf4; border:1px solid #bbf7d0; border-radius:10px; padding:12px 14px; font-size:12.5px; color:#166534}

.hist-pre{
  background:#f7f9fc; border:1px solid var(--line); border-radius:10px; padding:12px 14px;
  font-size:12.5px; line-height:1.75; white-space:pre-wrap; word-break:break-word;
  max-height:32vh; overflow-y:auto; color:#334155;
}

/* ---------------- 用量 ---------------- */
.bar-row{display:grid; grid-template-columns:110px 1fr 90px; gap:12px; align-items:center; margin-bottom:8px; font-size:12.5px}
.bar-row .day{color:var(--muted); font-size:12px}
.bar-row .bar{
  display:block; height:20px; background:#eef4ff; border-radius:5px; overflow:hidden;
}
.bar-row .bar > span{
  display:block; height:100%; border-radius:5px;
  background:linear-gradient(90deg,#60a5fa,#2563eb); min-width:3px;
}
.bar-row .amt{text-align:right; font-weight:600; color:#334155}

/* ---------------- 表格 ---------------- */
.table-wrap{overflow-x:auto}
.table-wrap table{width:100%; border-collapse:collapse; font-size:12.5px; min-width:640px}
.table-wrap th,.table-wrap td{
  padding:10px 12px; text-align:left; border-bottom:1px solid #eef1f6; vertical-align:middle;
}
.table-wrap th{background:#f7f9fc; font-weight:650; color:#475569; white-space:nowrap}
.table-wrap tbody tr:hover{background:#fafbfe}

.perm-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:8px}
.perm-item{display:flex; align-items:center; gap:7px; font-size:12.5px; color:#334155}
.perm-item input{width:auto}
.perm-tags{display:flex; gap:4px; flex-wrap:wrap}
.perm-tags .perm-item{background:#f4f6fa; border-radius:999px; padding:2px 8px; font-size:11px}
.mono{font-family:ui-monospace,Consolas,monospace; font-size:11.5px; color:#64748b}

/* ---------------- 供应商设置 ---------------- */
.prov{border:1px solid var(--line); border-radius:11px; padding:14px; margin-bottom:12px; background:#fff}
.prov-head{display:flex; align-items:center; gap:10px; margin-bottom:10px}
.prov-name{font-weight:650; font-size:13.5px}
.prov-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:10px}
.prov-foot{display:flex; align-items:center; gap:10px; margin-top:10px; flex-wrap:wrap}
.p-msg{font-size:11.5px; color:var(--muted); margin:0}
.prov-head .check{margin-top:0; margin-left:auto; flex:0 0 auto}
.p-test{flex:0 0 auto}
.p-enabled{width:auto !important}
.prov-grid input[type=password],.prov-grid input[type=text]{font-size:12.5px}
.t-prov{max-width:190px}
.t-enabled{width:auto !important; margin:0 auto; display:block}
.img-item.error{background:#fff5f5; border-color:#fecaca}
.img-item.error .slot-placeholder{color:var(--err)}
.save-bar{
  position:sticky; bottom:0; background:rgba(245,246,248,.95); backdrop-filter:blur(6px);
  padding:12px 0; display:flex; align-items:center; gap:12px; border-top:1px solid var(--line);
}

.p-key,.p-model,.p-base{font-family:ui-monospace,Consolas,monospace; font-size:12px}

/* ---------------- 绘图 ---------------- */
.split{display:grid; grid-template-columns:minmax(340px,1fr) minmax(340px,1.1fr); gap:16px; align-items:start}
@media (max-width:1000px){ .split{grid-template-columns:1fr} }
.style-row{display:flex; gap:8px; flex-wrap:wrap}
.style-chip{
  border:1px solid var(--line); background:#fff; color:#475569; border-radius:999px;
  padding:6px 13px; font-size:12px; cursor:pointer; font-family:inherit;
  transition:border-color .12s, background .12s;
}
.style-chip:hover{border-color:#c3d3f5; background:#f7f9ff}
.style-chip.active{background:var(--brand-soft); border-color:#b9cdf7; color:var(--brand); font-weight:600}
.style-hint{font-size:11.5px; color:var(--muted); margin-top:7px; min-height:17px}
.ratio-row{display:flex; gap:7px; flex-wrap:wrap}
.ratio{
  border:1px solid var(--line); background:#fff; color:#475569; border-radius:8px;
  padding:6px 11px; font-size:12px; cursor:pointer; font-family:inherit;
}
.ratio.active{background:var(--brand-soft); border-color:#b9cdf7; color:var(--brand); font-weight:600}
.seg{display:inline-flex; border:1px solid var(--line); border-radius:9px; overflow:hidden}
.seg-item{
  border:none; background:#fff; color:#475569; padding:8px 16px; font-size:12.5px;
  cursor:pointer; font-family:inherit; border-right:1px solid var(--line);
}
.seg-item:last-child{border-right:none}
.seg-item.active{background:var(--brand-soft); color:var(--brand); font-weight:600}
.size-hint{font-size:11.5px; color:var(--muted); margin:12px 0 4px}
.ref-box{
  border:1.5px dashed #cbd5e1; border-radius:11px; min-height:88px; display:flex;
  align-items:center; justify-content:center; cursor:pointer; background:#fafcff;
  overflow:hidden; padding:8px;
}
.ref-box:hover{border-color:var(--brand)}
.ref-box.has-ref{align-items:flex-start}
.ref-empty{font-size:12.5px; color:var(--muted); padding:18px 0; text-align:center; width:100%}
.ref-grid{
  display:grid; grid-template-columns:repeat(auto-fill,minmax(78px,1fr));
  gap:8px; width:100%;
}
.ref-prev{position:relative; border-radius:8px; overflow:hidden; border:1px solid var(--line); background:#fff; cursor:grab}
.ref-prev.dragging{opacity:.4; border-color:var(--brand)}
.ref-prev img{width:100%; height:78px; object-fit:cover; display:block}

/* 看大图 */
.lightbox{
  position:fixed; inset:0; z-index:300; background:rgba(8,12,20,.86);
  display:flex; align-items:center; justify-content:center; padding:24px;
}
.lightbox img{max-width:92vw; max-height:88vh; border-radius:10px; box-shadow:0 20px 60px rgba(0,0,0,.5)}
.lb-close{
  position:absolute; top:18px; right:20px; width:36px; height:36px; border-radius:50%;
  border:none; background:rgba(255,255,255,.16); color:#fff; font-size:16px; cursor:pointer;
}
.ref-prev .ref-clear{position:absolute; top:3px; right:3px; width:20px; height:20px; font-size:11px}
.ref-clear{
  position:absolute; top:6px; right:8px; width:24px; height:24px; border-radius:50%;
  border:none; background:rgba(15,23,42,.65); color:#fff; cursor:pointer; font-size:12px;
  line-height:1; display:flex; align-items:center; justify-content:center;
}
.result-area{
  min-height:320px; border:1px dashed var(--line); border-radius:11px; display:flex;
  align-items:center; justify-content:center; color:var(--muted); font-size:13px; padding:14px;
}
.result-area.has{border-style:solid; display:block}
.img-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:12px}
.img-item{border:1px solid var(--line); border-radius:10px; overflow:hidden; background:#fff; position:relative}
.img-item img{width:100%; display:block}
.img-item.pending{min-height:190px; display:flex; align-items:center; justify-content:center; background:#fafbfe}
.img-item .bar{display:flex; gap:8px; padding:8px 10px; font-size:11.5px; background:#fbfcfe; border-top:1px solid var(--line)}
.slot-placeholder{font-size:12px; color:var(--muted); padding:20px; text-align:center}
.video-out{display:flex; flex-direction:column; gap:10px; align-items:flex-start; width:100%}
.video-out video{width:100%; max-height:60vh; border-radius:10px; background:#000; display:block}
.hsel{width:auto !important; flex:0 0 auto; margin-top:4px}

/* ---------------- 弹层 ---------------- */
.modal{
  position:fixed; inset:0; z-index:150; display:flex; align-items:center; justify-content:center;
  background:rgba(15,23,42,.45); padding:20px;
}
.modal-box{
  width:100%; max-width:720px; max-height:88vh; background:#fff; border-radius:14px;
  box-shadow:0 24px 60px rgba(2,6,23,.3); display:flex; flex-direction:column; overflow:hidden;
}
.modal-head{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:16px 20px; border-bottom:1px solid var(--line); font-weight:650; font-size:14px;
}
.modal-body{padding:18px 20px; overflow-y:auto}
.modal-body video{width:100%; max-height:46vh; border-radius:10px; background:#000}
.m-meta{font-size:12px; color:var(--muted); margin:10px 0 14px; line-height:1.8}
.video-warn{
  margin-top:10px; background:var(--warn-soft); border:1px solid #f3d9a4; color:#92400e;
  border-radius:9px; padding:10px 12px; font-size:12.5px; line-height:1.7;
}

/* AI 先审 */
.ai-bar{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  border:1px dashed #c7d7f5; background:#f7faff; border-radius:10px;
  padding:10px 12px; margin-bottom:14px;
}
.ai-result{
  border:1px solid #dbe7fb; background:#fbfdff; border-radius:10px;
  padding:12px 14px; margin-bottom:16px;
}
.ai-head{font-size:12.5px; font-weight:650; color:#1e40af; margin-bottom:9px}
.issue-list{display:flex; flex-direction:column; gap:6px}
.issue-row{display:flex; gap:9px; align-items:flex-start; font-size:12.5px; cursor:pointer; line-height:1.65}
.issue-row input{width:auto; margin-top:3px; flex:0 0 auto}
.issue-main b{color:var(--brand); font-weight:650; margin-right:4px}
.issue-advice{display:block; color:#64748b; font-size:12px; margin-top:2px}
.ai-frames{margin-top:10px; font-size:12px; color:var(--muted)}
.ai-frames summary{cursor:pointer; outline:none}
.frame-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(110px,1fr)); gap:6px; margin-top:8px}
.frame-grid img{width:100%; border-radius:6px; border:1px solid var(--line); display:block}

/* ---------------- 通知 ---------------- */
.notif-panel{
  position:absolute; top:64px; right:24px; width:340px; max-height:60vh; z-index:120;
  background:#fff; border:1px solid var(--line); border-radius:12px;
  box-shadow:0 18px 40px rgba(15,23,42,.16); display:flex; flex-direction:column; overflow:hidden;
}
.np-head{display:flex; align-items:center; justify-content:space-between; padding:12px 14px; border-bottom:1px solid var(--line); font-weight:650; font-size:13px}
.np-list{overflow-y:auto}
.np-item{padding:11px 14px; border-bottom:1px solid #f0f2f6; font-size:12.5px; cursor:pointer}
.np-item:hover{background:#fafbfe}
.np-item.unread{background:#f5f9ff}

/* ---------------- 版本历史 ---------------- */
.ver-row{display:flex; align-items:center; gap:10px; padding:11px 4px; border-bottom:1px solid #f0f2f6; font-size:13px}
.ver-row .vn{font-weight:650; color:var(--brand); flex:0 0 40px}
.ver-row .vmain{flex:1; min-width:0}
.ver-row .vmain b{display:block; font-weight:600}
.ver-row .vmain span{font-size:11.5px; color:var(--muted)}

/* ---------------- 移动端 ---------------- */
@media (max-width:820px){
  /* ---------- 骨架：整屏、安全区 ---------- */
  html,body{height:auto; overflow-x:hidden}
  body{font-size:14px; -webkit-text-size-adjust:100%}
  .app{flex-direction:column; height:100vh; height:100dvh; overflow:hidden}

  /* ---------- 顶部：品牌 + 导航（可横滑） ---------- */
  .sidebar{
    width:100%; flex:0 0 auto; flex-direction:row; align-items:center;
    overflow-x:auto; overflow-y:hidden; padding:6px 8px; gap:4px;
    padding-top:calc(6px + env(safe-area-inset-top));
    -webkit-overflow-scrolling:touch; scrollbar-width:none;
  }
  .sidebar::-webkit-scrollbar{display:none}
  .brand{padding:0 8px 0 2px; gap:8px}
  .brand-mark{width:30px; height:30px; flex:0 0 30px; font-size:15px}
  .brand-text{display:none}
  #nav{display:flex; gap:4px; padding:0; overflow:visible; flex:1; min-width:0}
  .nav-item{
    white-space:nowrap; padding:7px 11px; font-size:12.5px; margin:0;
    border-radius:999px; background:rgba(255,255,255,.06);
  }
  .nav-item span{font-size:12.5px; overflow:visible; text-overflow:clip}
  .nav-item.active{background:var(--sidebar-3)}
  .side-foot{display:none}

  /* ---------- 标题栏 ---------- */
  .topbar{
    padding:8px 12px; gap:8px; flex:0 0 auto;
    border-bottom:1px solid var(--line);
  }
  .topbar h1{font-size:15px; line-height:1.3}
  .topbar .sub{font-size:11.5px; margin-top:1px}
  .top-actions{gap:6px}
  .icon-btn{width:34px; height:34px; font-size:14px}
  .user-chip{padding:4px 8px; font-size:12px}
  .user-chip .caret{display:none}
  .avatar-sm{width:24px; height:24px; flex:0 0 24px; font-size:11px}

  /* ---------- 内容区 ---------- */
  .content{padding:10px 10px calc(80px + env(safe-area-inset-bottom))}
  .card{padding:12px; border-radius:11px; margin-bottom:10px}
  .card-head{font-size:13px; margin-bottom:10px; flex-wrap:wrap; gap:6px}
  .section-title{font-size:12.5px; margin:14px 0 8px}
  .row{gap:8px; margin-top:8px}
  .field{min-width:100%; flex:1 1 100%}
  .hint{font-size:11.5px}

  /* 输入框 16px：避免 iOS 聚焦时自动放大 */
  input[type=text],input[type=password],input[type=number],input:not([type]),select,textarea{
    font-size:16px; padding:10px 12px;
  }
  textarea{line-height:1.6}

  /* 按钮：手指友好 */
  .btn{padding:10px 14px; font-size:13px; min-height:40px}
  .btn.small{padding:8px 12px; font-size:12.5px; min-height:36px}
  .btn.tiny{padding:7px 10px; font-size:12px; min-height:32px}
  .btn.block{margin-top:12px}

  /* ---------- 统计 / 任务卡 ---------- */
  .stat-row{grid-template-columns:1fr 1fr; gap:8px}
  .stat{padding:11px 12px}
  .stat .v{font-size:17px}
  .task-grid{grid-template-columns:1fr 1fr; gap:9px}
  .task-card{padding:11px}
  .task-card .ico{height:28px}
  .task-card .ico img{height:28px; max-width:42px}
  .task-card .t{font-size:13px; margin-top:4px}
  .task-card .d{font-size:11px; line-height:1.45}
  .task-card .m{display:none}

  /* ---------- 对话 ---------- */
  .chat-card{min-height:auto; height:calc(100dvh - 190px); display:flex; flex-direction:column}
  .chat-head{flex-wrap:wrap; gap:6px; padding-bottom:9px; margin-bottom:9px}
  .chat-body{flex:1; min-height:0; max-height:none; overflow-y:auto}
  .bubble{max-width:94%; padding:9px 12px; font-size:13.5px}
  .msg{gap:7px; margin-bottom:12px}
  .avatar{width:26px; height:26px; flex:0 0 26px; font-size:10.5px}
  .chat-mats{gap:6px; padding:8px 0}
  .chat-input{position:sticky; bottom:0; background:#fff; padding:8px 0 2px; gap:7px}
  .chat-input textarea{min-height:42px; font-size:16px}
  .chat-input .btn{height:42px; min-height:42px; padding:0 16px}
  .msg.bot{max-width:100%}

  /* 表格：横向滑动，字号缩小 */
  .md-table{border-radius:8px; -webkit-overflow-scrolling:touch}
  .bubble .md-table table{min-width:520px; font-size:12px}
  .bubble th,.bubble td{padding:7px 9px; line-height:1.55}
  .bubble th:nth-child(1),.bubble td:nth-child(1){width:15%}
  .bubble th:nth-child(2),.bubble td:nth-child(2){width:24%}
  .bubble th:nth-child(3),.bubble td:nth-child(3){width:30%}
  .bubble th:nth-child(4),.bubble td:nth-child(4){width:31%}
  .bubble th:nth-child(5),.bubble td:nth-child(5){width:auto}
  .btn.table-export{margin:6px 0 4px}

  /* ---------- 提示词栏 ---------- */
  .prompt-bar{margin-top:8px; padding-top:8px}
  .pb-head{gap:6px; margin-bottom:6px}
  .pb-label{font-size:11.5px}
  .pb-chips{gap:5px}
  .pb-chip{font-size:11px; padding:4px 9px}
  .pb-toggle{font-size:11px}
  .pb-cards{grid-template-columns:1fr; gap:6px}
  .prompt-card{padding:9px 11px}
  .pc-title{font-size:12.5px}
  .pc-preview{font-size:11.5px; -webkit-line-clamp:2}

  /* ---------- 绘图 / 视频 ---------- */
  .split{grid-template-columns:1fr; gap:10px}
  .ratio-row,.style-row{gap:6px}
  .ratio,.style-chip{padding:8px 12px; font-size:12.5px; min-height:36px}
  .seg-item{padding:9px 14px; font-size:12.5px; min-height:38px}
  .ref-grid{grid-template-columns:repeat(auto-fill,minmax(64px,1fr)); gap:6px}
  .ref-prev img{height:64px}
  .result-area{min-height:200px; padding:10px}
  .img-grid{grid-template-columns:1fr 1fr; gap:8px}
  .size-hint{font-size:11.5px}

  /* ---------- 素材库 ---------- */
  .folder-grid{grid-template-columns:1fr 1fr; gap:9px}
  .folder-thumb{height:76px}
  .folder-thumb img{max-height:76px}
  .folder-name{font-size:12.5px}
  .folder-meta{font-size:10.5px}
  .mat-row{flex-wrap:wrap; padding:11px 2px; gap:9px}
  .mat-ico{width:34px; height:34px; flex:0 0 34px; font-size:9px}
  .mat-title{font-size:13px}
  .mat-preview{display:none}
  .mat-side{flex-direction:row; width:100%; justify-content:flex-start; gap:5px}
  .mat-crumb{font-size:12px}

  /* ---------- 列表 / 历史 ---------- */
  .list-row{flex-wrap:wrap; gap:6px; padding:11px 2px}
  .list-row .when{flex:0 0 100%; font-size:11px}
  .list-row .what{flex:1 1 100%; font-size:12.5px}
  .list-row .cost{font-size:11.5px}
  .mat-stats{gap:9px; font-size:11.5px}

  /* ---------- 用量 ---------- */
  .bar-row{grid-template-columns:64px 1fr 62px; gap:7px; font-size:11.5px}

  /* ---------- 表格页 ---------- */
  .table-wrap{-webkit-overflow-scrolling:touch}
  .table-wrap table{min-width:560px; font-size:12px}
  .table-wrap th,.table-wrap td{padding:8px 9px}

  /* ---------- 弹层：手机全屏 ---------- */
  .modal{padding:0; align-items:flex-end}
  .modal-box{
    max-width:100% !important; width:100%; max-height:92dvh; max-height:92vh;
    border-radius:16px 16px 0 0;
  }
  .modal-head{padding:13px 16px; font-size:14px}
  .modal-body{padding:14px 16px calc(16px + env(safe-area-inset-bottom))}
  .modal-body video{max-height:38vh}
  .notif-panel{right:8px; left:8px; width:auto; top:56px; max-height:70vh}
  .save-bar{padding:10px 0 calc(10px + env(safe-area-inset-bottom))}

  /* 关大图 */
  .lightbox{padding:12px}
  .lightbox img{max-width:96vw; max-height:82vh}
}

/* 小屏（iPhone SE 之类）再收一档 */
@media (max-width:420px){
  .task-grid{grid-template-columns:1fr}
  .folder-grid{grid-template-columns:1fr 1fr}
  .topbar .sub{display:none}
  .chat-card{height:calc(100dvh - 176px)}
  .content{padding:8px 8px calc(70px + env(safe-area-inset-bottom))}
  .card{padding:11px}
}

/* ---------- 客户与计划 / 客服话术 / 财务月报 ---------- */
.crm-row{
  display:flex; align-items:center; gap:10px; padding:9px 10px;
  border:1px solid #e8edf4; border-radius:10px; margin-bottom:8px; background:#fff;
}
.crm-row.today{border-color:#f0c9a0; background:#fffaf3}
.crm-row.overdue{border-color:#f2b8b8; background:#fff5f5}
.crm-date{font-size:12px; color:#64748b; white-space:nowrap}
.crm-main{flex:1; min-width:0; display:flex; align-items:center; gap:8px; flex-wrap:wrap}
.crm-ops{display:flex; gap:6px}
.chip-type{font-size:11.5px; color:#475569; background:#eef2f7; border-radius:6px; padding:1px 7px}
.sv-meta{display:flex; gap:8px; flex-wrap:wrap; margin:10px 0}
.sv-trans{background:#f6f8fb; border-radius:10px; padding:10px 12px; font-size:13.5px; color:#334155; margin-bottom:10px; line-height:1.6}
.sv-replies{display:flex; flex-direction:column; gap:8px}
.sv-reply{display:flex; align-items:flex-start; gap:10px; border:1px solid #e8edf4; border-radius:10px; padding:10px 12px; background:#fff}
.sv-text{flex:1; font-size:13.5px; line-height:1.65; color:#1f2937}
.sv-add{margin-top:10px}
.sv-add summary{cursor:pointer; font-size:13px; color:#1f3a8a; padding:6px 0}
.fin-head{font-size:15px; font-weight:700; color:#1f2937; margin:6px 0 10px}
.fin-grid{display:grid; grid-template-columns:repeat(4, 1fr); gap:10px}
.fin-cell{border:1px solid #e8edf4; border-radius:10px; padding:10px 12px; background:#fff}
.fin-k{font-size:12px; color:#64748b; margin-bottom:4px}
.fin-v{font-size:16px; font-weight:700; color:#1f2937}
.fin-cell.minus .fin-v{color:#b03030}
.fin-cell.strong .fin-v{color:#1f3a8a}
.fin-cell.good .fin-v{color:#16803c}
.fin-cell.bad .fin-v{color:#c0272d}
.fin-log{font-size:12.5px; padding:4px 0; color:#475569}
@media (max-width:820px){
  .fin-grid{grid-template-columns:repeat(2, 1fr)}
  .crm-row{flex-wrap:wrap}
  .crm-ops{margin-left:auto}
}

/* 长表格折叠 */
.md-table.collapsed{max-height:300px; overflow:auto}
.md-table{max-height:none; overflow:auto}
.table-fold{
  display:block; margin:-4px 0 12px auto;
  background:#f1f4f9; color:#1f3a8a; border-color:#dde5f2;
}

/* ---- Token 余额卡片（首页第一张，深蓝底） ---- */
.stat.hot {
  background: linear-gradient(135deg, #1f3a8a 0%, #2b4fae 100%);
  border-color: #1f3a8a;
}
.stat.hot .k { color: #c7d2e6; }
.stat.hot .v { color: #ffffff; font-size: 26px; letter-spacing: .5px; }
.stat.hot .v small { color: #c7d2e6; }
.stat.hot.low {
  background: linear-gradient(135deg, #b03030 0%, #c0272d 100%);
  border-color: #b03030;
}

/* ---- 素材查看弹层 ---- */
.mat-jump{cursor:pointer}
.mat-jump:hover .mat-title{color:var(--brand)}
.mat-meta{font-size:12px; color:var(--muted); margin-bottom:10px; line-height:1.6}
.mat-full{
  margin:0; white-space:pre-wrap; word-break:break-word;
  font-family:"Songti SC",SimSun,"Microsoft YaHei",monospace;
  font-size:13px; line-height:1.9; color:#334155;
  background:#fafbfd; border:1px solid #eef1f6; border-radius:10px;
  padding:14px 16px; max-height:56vh; overflow:auto;
  -webkit-user-select:text; user-select:text;
}
.mat-full-img{max-width:100%; max-height:56vh; border-radius:10px; display:block; margin:0 auto}
