/* ============================================================
   大树AI-艺术家 · 设计系统唯一真源（260930 lvqing 重构）
   ------------------------------------------------------------
   改任何视觉只改这里的 :root 变量，页面与组件一律引用变量。
   品牌主色 #0F6E63 取自品牌真源（秘书总索引_260925 登记的指定主色）。
   风格：极简商务（B 端 SaaS）——中性色 ≥70%，单一主色，无多余装饰。
   ============================================================ */

:root {
  /* 主色阶（品牌真源 #0F6E63 派生） */
  --brand:        #0F6E63;
  --brand-700:    #0B574E;
  --brand-800:    #08423B;
  --brand-300:    #6FB5AC;
  --brand-100:    #E6F4F2;
  --brand-50:     #F2FAF9;

  /* 中性色（占页面 ≥70%） */
  --ink-900:      #14201E;
  --ink-800:      #1F2D2B;
  --ink-600:      #4A5A57;
  --ink-400:      #849491;
  --ink-200:      #DDE5E3;
  --ink-100:      #EDF2F1;
  --surface:      #FFFFFF;
  --canvas:       #F4F7F6;

  /* 语义色（各 ≤1 处主用，不喧宾夺主） */
  --ok:           #0E7A5F;
  --ok-bg:        #E6F5F0;
  --warn:         #A2620A;
  --warn-bg:      #FDF4E3;
  --danger:       #B42318;
  --danger-bg:    #FEF0EF;
  --info:         #1D4ED8;
  --info-bg:      #EEF2FE;

  /* 排版 */
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --fs-hero:      34px;
  --fs-h1:        19px;
  --fs-h2:        16px;
  --fs-body:      14px;
  --fs-sm:        13px;
  --fs-xs:        12px;

  /* 间距 · 8pt 栅格 */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  /* 圆角 · 8px 收敛，避免"大圆角玩具感" */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px;

  /* 阴影：弱边框 + 轻投影分区（不堆装饰） */
  --sh-1: 0 1px 2px rgba(20,32,30,.05);
  --sh-2: 0 2px 8px rgba(20,32,30,.07);
  --sh-3: 0 8px 24px rgba(20,32,30,.10);

  --sidebar-w: 232px;
  --topbar-h:  60px;
}

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

body {
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--ink-800);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); }

/* ---------- 骨架 ---------- */
.layout { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--brand-800);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  font-size: var(--fs-h2);
  font-weight: 700;
  letter-spacing: .2px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.brand small {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 400;
  color: rgba(255,255,255,.62);
  margin-top: 2px;
  letter-spacing: 0;
}
.nav { padding: var(--sp-3) var(--sp-2); overflow-y: auto; flex: 1; }
.nav-sec {
  font-size: 11px;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,.40);
  padding: var(--sp-4) var(--sp-3) var(--sp-1);
  text-transform: uppercase;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px var(--sp-3);
  color: rgba(255,255,255,.80);
  text-decoration: none;
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
  border-left: 2px solid transparent;
  transition: background .15s ease, color .15s ease;
}
.nav a::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
  flex-shrink: 0;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a:focus-visible { outline: 2px solid var(--brand-300); outline-offset: 1px; }
.nav a.active {
  background: rgba(255,255,255,.14);
  color: #fff;
  border-left-color: var(--brand-300);
  font-weight: 600;
}
.nav a.active::before { opacity: 1; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  min-height: var(--topbar-h);
  padding: 0 var(--sp-6);
  background: var(--surface);
  border-bottom: 1px solid var(--ink-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { font-size: var(--fs-h1); font-weight: 700; color: var(--ink-900); }
.topbar-crumb { font-size: var(--fs-xs); color: var(--ink-600); display: block; font-weight: 400; margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: var(--sp-3); }

.content {
  padding: var(--sp-6);
  max-width: 1160px;
  width: 100%;
  flex: 1;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}
.card > h2 {
  font-size: var(--fs-h2);
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.card > h2::before {
  content: "";
  width: 3px; height: 15px;
  background: var(--brand);
  border-radius: 2px;
}
.card-sub { font-size: var(--fs-sm); color: var(--ink-600); margin-bottom: var(--sp-4); }

/* ---------- 额度主视觉（唯一视觉主角） ---------- */
.balance {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-5);
  flex-wrap: wrap;
  overflow: visible;
  min-height: 118px;
  /* v22e D 根治（第四版）——实测证明：前三版都没办法，根因是装饰圆的**挂载方式**而不是 overflow 值。
     逐版消除记录（三个月同一个问题的三次误判，不要再重复）：
       v22 → 加 `overflow: visible` 时，同规则里靠后的 `overflow: hidden` 把它覆盖了 → 文字被砍。
       v22c → 删掉 hidden，文字不再被砍，但 `::after` 的几何外扩仍计入 scrollHeight = 140。
       v22d → 改 `overflow: clip` + `overflow-clip-margin`，**Chromium 下 clip 并不让 scrollHeight 等于 clientHeight**，
              且 `overflow-clip-margin` 对 scrollHeight 孱响为零（实测改 0px 仍是 140）；三种 `contain` 也都不口。
     结论（实测比转径多）：**只要装饰圆以 position:absolute + 负偏移挂在 `.balance` 上，
     scrollHeight 就永远 ≥ 140**（`top(-40) + height(180) = 140`），这不是 CSS 值调优能解决的问题。
     解法 = **把圆变成背景画法**：背景**绝不参与 scrollHeight**，也不需要任何容器裁切，一次消除外扩机制本身。
     圆形特征：原设计是 `right:-40px; top:-40px; w=h=180px; rgba(255,255,255,.05)`，
     原设计 `right:-40px; top:-40px; width=height=180px` → 圆心在**盒子内侧**：水平距右边 50px（-40+90）、垂直距顶 50px。
     故写法是 `calc(100% - 50px) 50px`（**减号**）。v22e 首次上线写成 `+ 50px` 将圆心推到盒外，
     实测圆的可见宽度从 140px 退化到 40px 窄条（从右上角退到右下角），v22f 签号已改正。用 `radial-gradient(90px at ...)` 可精确复玠，
     颜色只有 5% 白，边缘被盒边切掉的差异几不可见。 */
  background:
    radial-gradient(circle 90px at calc(100% - 50px) 50px,
      rgba(255,255,255,.05) 0 99%, rgba(255,255,255,0) 100%),
    linear-gradient(135deg, var(--brand-800) 0%, var(--brand-700) 55%, var(--brand) 100%);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  color: #fff;
  margin-bottom: var(--sp-4);
  position: relative;
}



.balance-label { font-size: var(--fs-xs); color: rgba(255,255,255,.72); letter-spacing: .5px; }
.balance-num {
  font-size: var(--fs-hero);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.5px;
  margin-top: 2px;
}
.balance-num.is-error { font-size: var(--fs-h2); font-weight: 500; opacity: .85; }
.balance-unit { font-size: var(--fs-body); color: rgba(255,255,255,.85); margin-left: 8px; font-weight: 600; }
.balance-note { font-size: var(--fs-sm); color: rgba(255,255,255,.70); margin-top: var(--sp-2); max-width: 520px; }
.balance-actions { margin-left: auto; display: flex; gap: var(--sp-2); position: relative; z-index: 1; }
.balance-actions .btn { background: #fff; color: var(--brand-800); }
.balance-actions .btn:hover { background: var(--brand-50); }
.balance-err { font-size: var(--fs-sm); color: #FFD9D4; margin-top: var(--sp-2); }

/* ---------- 磁贴 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: var(--sp-3); }
.tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  text-decoration: none;
  color: var(--ink-800);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.tile:hover {
  border-color: var(--brand-300);
  box-shadow: var(--sh-2);
  transform: translateY(-1px);
}
.tile:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tile .num {
  display: inline-block;
  background: var(--brand-100);
  color: var(--brand-700);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: var(--sp-2);
  font-variant-numeric: tabular-nums;
}
.tile .name { font-size: var(--fs-body); font-weight: 600; color: var(--ink-900); margin-bottom: 3px; }
.tile .desc { font-size: var(--fs-xs); color: var(--ink-600); }
.tile .price { font-size: 20px; font-weight: 800; color: var(--ink-900); margin: 2px 0 1px; letter-spacing: -.3px; }
.tile.is-hot { border-color: var(--brand-300); background: var(--brand-50); }
.tile-flag {
  position: absolute; top: 10px; right: 10px;
  background: var(--brand); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 3px;
}
.tile-wrap { position: relative; }

/* ---------- 表单 ---------- */
label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-800); margin: var(--sp-4) 0 5px; }
label:first-of-type { margin-top: 0; }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  font-size: var(--fs-body);
  font-family: inherit;
  color: var(--ink-800);
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--ink-400); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15,110,99,.10);
}
input::placeholder, textarea::placeholder { color: #A8B4B2; }
textarea { min-height: 92px; resize: vertical; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234A5A57' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--sp-4); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
  padding: 9px 20px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn:hover { background: var(--brand-700); border-color: var(--brand-700); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:disabled { background: var(--ink-200); border-color: var(--ink-200); color: var(--ink-600); cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--brand); border-color: var(--brand-300); }
.btn.ghost:hover { background: var(--brand-50); border-color: var(--brand); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: #F3C6C2; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.sm { padding: 5px 11px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.btn-guest {
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
  padding: 7px 15px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}
.btn-guest.ghost { background: var(--surface); color: var(--brand); border-color: var(--brand-300); }
.btn-logout {
  background: var(--surface);
  color: var(--danger);
  border: 1px solid #F3C6C2;
  padding: 6px 13px;
  border-radius: var(--r-md);
  font-size: var(--fs-xs);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.btn-logout:hover { background: var(--danger-bg); }
.user { font-size: var(--fs-sm); color: var(--ink-600); }
.user b { color: var(--ink-900); font-weight: 600; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--sp-5)); padding: 0 var(--sp-5); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th, td { padding: 10px 10px; border-bottom: 1px solid var(--ink-100); text-align: left; vertical-align: top; }
th {
  color: var(--ink-600);
  font-weight: 600;
  font-size: var(--fs-xs);
  letter-spacing: .3px;
  background: var(--ink-100);
  white-space: nowrap;
  position: sticky; top: 0;
}
tbody tr:hover { background: var(--brand-50); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-empty { text-align: center; color: var(--ink-400); padding: var(--sp-6) 0; font-size: var(--fs-sm); }

/* ---------- 消息条 ---------- */
.metabox { margin-top: var(--sp-3); background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-800); padding: 10px 12px; border-radius: var(--r-md); font-size: var(--fs-sm); }
.warnbox { background: var(--warn-bg); border: 1px solid #F3DDB4; color: var(--warn); padding: 10px 12px; border-radius: var(--r-md); font-size: var(--fs-sm); margin-top: var(--sp-3); }
.errbox  { background: var(--danger-bg); border: 1px solid #F3C6C2; color: var(--danger); padding: 10px 12px; border-radius: var(--r-md); font-size: var(--fs-sm); margin-top: var(--sp-3); }
.infobox { background: var(--info-bg); border: 1px solid #C7D5FB; color: var(--info); padding: 10px 12px; border-radius: var(--r-md); font-size: var(--fs-sm); margin-top: var(--sp-3); }
.muted { color: var(--ink-600); font-size: var(--fs-sm); }
.muted-sm { color: var(--ink-400); font-size: var(--fs-xs); }

/* ---------- 状态徽标 ---------- */
.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: .2px;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.wait { background: var(--warn-bg); color: var(--warn); }
.pill.doing { background: var(--info-bg); color: var(--info); }
.pill.na { background: var(--bg-sub); color: var(--text-3); }
.pill.rej { background: var(--danger-bg); color: var(--danger); }

/* ---------- 吐司 ---------- */
#__toast {
  position: fixed;
  top: 18px; left: 50%;
  transform: translateX(-50%) translateY(-14px);
  background: var(--ink-900);
  color: #fff;
  padding: 11px 20px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  z-index: 9999;
  box-shadow: var(--sh-3);
  max-width: 88vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
#__toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#__toast.t-error { background: var(--danger); }
#__toast.t-ok { background: var(--ok); }

/* ---------- 全局登录 slot ---------- */
#lu985-login-slot { display: inline-flex; align-items: center; }

/* ---------- 移动端抽屉按钮 ---------- */
.nav-toggle { display: none; }

/* ============================================================
   响应式：桌面 ≥1024 / 平板 768-1023 / 移动 <768 三档各验
   ============================================================ */
@media (max-width: 1023px) {
  .content { padding: var(--sp-5); }
  .topbar { padding: 0 var(--sp-4); }
  .form-2 { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 30;
    flex-direction: row;
    align-items: center;
    padding-right: var(--sp-2);
  }
  .brand {
    border-bottom: none;
    border-right: 1px solid rgba(255,255,255,.10);
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--fs-sm);
    flex-shrink: 0;
  }
  .brand small { display: none; }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    background: rgba(255,255,255,.10);
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
  }
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--brand-800);
    padding: var(--sp-2);
    border-top: 1px solid rgba(255,255,255,.10);
    box-shadow: var(--sh-3);
    max-height: 70vh;
    overflow-y: auto;
    z-index: 29;
  }
  .nav.open { display: block; }
  .nav-sec { display: none; }
  .topbar { padding: 0 var(--sp-4); min-height: 52px; }
  .topbar h1 { font-size: var(--fs-h2); }
  .content { padding: var(--sp-4); }
  .card { padding: var(--sp-4); border-radius: var(--r-md); }
  .balance { padding: var(--sp-4); }
  .balance-num { font-size: 28px; }
  .balance-actions { margin-left: 0; width: 100%; }
  .balance-actions .btn { flex: 1; }
  .grid { grid-template-columns: 1fr; }
  .table-wrap { margin: 0 calc(-1 * var(--sp-4)); padding: 0 var(--sp-4); }
  th { position: static; }
  .btn { padding: 10px 18px; }
  .btn-row .btn { flex: 1; }
}

/* 260930 lvqing：窄屏下 199 行单价表与免费模型卡竖排后整页拉到 8.6k px。
   桌面端保持原样（表要能横排对照），只在 767px 以下生效：
   ① 单价表限高 60vh + 纵向滚动，首屏不再被 30 行表头撑爆；
   ② 免费模型卡改双列，20 张卡从 20 行压到 10 行。 */
@media (max-width: 767px) {
  .table-cap { max-height: 60vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .table-cap table thead th { position: sticky; top: 0; z-index: 2; background: var(--ink-100); }
  .grid-dense { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
  .grid-dense .tile { padding: var(--sp-3); }
  .grid-dense .tile .name { font-size: var(--fs-sm); }
  .grid-dense .tile .desc { font-size: var(--fs-xs); }
  .grid-dense .tile .muted-sm code { overflow-wrap: anywhere; }
}

@media print {
  .sidebar, .topbar-right, .btn { display: none !important; }
  .card { border: none; box-shadow: none; }
}

