/* ============ 应用骨架 ============ */
.app-shell{display:flex;min-height:100vh}

/* 侧边栏 */
.sidebar{
  width:var(--sidebar-w);flex:0 0 var(--sidebar-w);
  background:linear-gradient(180deg,var(--brand-900) 0%,var(--brand-800) 100%);
  color:#c7d3e4;display:flex;flex-direction:column;
  position:fixed;inset:0 auto 0 0;z-index:40;
  transition:width .22s ease,flex-basis .22s ease;
  border-right:1px solid rgba(255,255,255,.05);
}
.app-shell.collapsed .sidebar{width:var(--sidebar-w-collapsed);flex-basis:var(--sidebar-w-collapsed)}
.app-shell.collapsed .brand-text,
.app-shell.collapsed .nav-section-title,
.app-shell.collapsed .nav-label,
.app-shell.collapsed .nav-chevron,
.app-shell.collapsed .sidebar-tip,
.app-shell.collapsed .sidebar-version{display:none}
.app-shell.collapsed .nav-item{justify-content:center;padding:10px 0}
.app-shell.collapsed .sidebar-brand{justify-content:center;padding:18px 0}

.sidebar-brand{
  height:var(--topbar-h);display:flex;align-items:center;gap:10px;
  padding:0 18px;border-bottom:1px solid rgba(255,255,255,.07);flex:0 0 auto;
}
.brand-logo{
  width:32px;height:32px;flex:0 0 32px;border-radius:8px;
  background:linear-gradient(135deg,#3b82f6,#1d4ed8);
  color:#fff;font-weight:700;font-size:16px;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 2px 8px rgba(37,99,235,.4);
}
.brand-text{display:flex;flex-direction:column;line-height:1.25;white-space:nowrap}
.brand-text strong{color:#fff;font-size:15px;letter-spacing:.5px}
.brand-text span{font-size:10px;color:#7f92ac;letter-spacing:.5px}

.sidebar-nav{flex:1;overflow-y:auto;overflow-x:hidden;padding:12px 0}
.sidebar-nav::-webkit-scrollbar{width:0}
.nav-section{margin-bottom:6px}
.nav-section-title{
  padding:12px 18px 6px;font-size:10px;letter-spacing:1.5px;
  color:#617693;font-weight:600;text-transform:uppercase;white-space:nowrap;
}
.nav-item{
  display:flex;align-items:center;gap:11px;
  padding:9px 18px;margin:1px 8px;border-radius:7px;
  color:#c2d0e2;font-size:13px;position:relative;
  cursor:pointer;transition:background .15s,color .15s;white-space:nowrap;
}
.nav-item:hover{background:rgba(255,255,255,.06);color:#fff}
.nav-item.active{background:var(--primary);color:#fff;box-shadow:0 2px 10px rgba(31,90,168,.35)}
.nav-item.active::before{content:"";position:absolute;left:-8px;top:50%;transform:translateY(-50%);width:3px;height:20px;background:#7db1f0;border-radius:0 3px 3px 0}
.nav-item svg{width:17px;height:17px;flex:0 0 17px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;opacity:.9}
.nav-label{flex:1}
.nav-badge{background:rgba(255,255,255,.14);color:#fff;font-size:10px;padding:1px 6px;border-radius:9px}
.nav-chevron{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:2;transition:transform .2s;opacity:.6}
.nav-item.expanded .nav-chevron{transform:rotate(90deg)}

.sidebar-footer{padding:14px 18px;border-top:1px solid rgba(255,255,255,.07);white-space:nowrap}
.sidebar-tip{font-size:11px;color:#8fa3bd;display:flex;align-items:center;gap:7px}
.sidebar-tip .dot{width:6px;height:6px;border-radius:50%;background:#35c88a;box-shadow:0 0 0 3px rgba(53,200,138,.15)}
.sidebar-version{font-size:10px;color:#5a6d88;margin-top:5px}

/* 主区域 */
.app-main{margin-left:var(--sidebar-w);flex:1;min-width:0;transition:margin-left .22s ease;display:flex;flex-direction:column}
.app-shell.collapsed .app-main{margin-left:var(--sidebar-w-collapsed)}

/* 顶栏 */
.topbar{
  height:var(--topbar-h);flex:0 0 var(--topbar-h);
  background:var(--surface);border-bottom:1px solid var(--line);
  display:flex;align-items:center;gap:16px;padding:0 24px;
  position:sticky;top:0;z-index:30;
}
.icon-btn{
  width:34px;height:34px;border:0;background:transparent;border-radius:7px;
  display:flex;align-items:center;justify-content:center;color:var(--ink-600);position:relative;
}
.icon-btn:hover{background:var(--surface-3);color:var(--ink-900)}
.icon-btn svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.collapse-btn svg{width:18px;height:18px}
.badge-dot{
  position:absolute;top:1px;right:0;min-width:15px;height:15px;padding:0 3px;
  background:var(--danger);color:#fff;border-radius:8px;font-size:9px;line-height:15px;text-align:center;font-weight:600;
}
.topbar-context{display:flex;align-items:center;gap:8px}
.ctx-label{font-size:12px;color:var(--ink-500);white-space:nowrap}
.ctx-select{
  border:1px solid var(--line);background:var(--surface);border-radius:6px;
  padding:6px 26px 6px 10px;font-size:12px;color:var(--ink-800);
  max-width:210px;cursor:pointer;
  appearance:none;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a6a7e' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat:no-repeat;background-position:right 8px center;
}
.ctx-select.period{max-width:120px}
/* 可输入搜索的账套下拉 */
.ctx-combo{position:relative}
.ctx-combo-trigger{
  display:flex;align-items:center;gap:6px;width:240px;max-width:240px;
  padding:6px 26px 6px 10px;line-height:1.5;text-align:left;
  background-image:none;cursor:pointer;position:relative;
}
.ctx-combo-trigger svg{
  width:12px;height:12px;flex:0 0 12px;fill:none;stroke:var(--ink-500);stroke-width:2;
  position:absolute;right:8px;top:50%;transform:translateY(-50%);
}
.ctx-combo-label{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
.ctx-combo-menu{
  position:absolute;top:calc(100% + 6px);left:0;width:320px;max-height:360px;
  background:var(--surface);border:1px solid var(--line);border-radius:8px;
  box-shadow:0 12px 32px rgba(20,40,70,.14);z-index:80;overflow:hidden;
}
.ctx-combo-menu[hidden]{display:none}
.ctx-combo-search-box{display:flex;align-items:center;gap:6px;padding:8px 10px;border-bottom:1px solid var(--line-soft)}
.ctx-combo-search-box svg{width:14px;height:14px;flex:0 0 14px;fill:none;stroke:var(--ink-400);stroke-width:1.8}
.ctx-combo-search{border:0;outline:0;background:transparent;font-size:12px;color:var(--ink-800);width:100%}
.ctx-combo-search::placeholder{color:var(--ink-400)}
.ctx-combo-list{max-height:280px;overflow:auto;padding:4px}
.ctx-combo-option{
  display:flex;flex-direction:column;gap:2px;width:100%;text-align:left;
  padding:8px 10px;border:0;border-radius:6px;background:transparent;cursor:pointer;
}
.ctx-combo-option:hover,.ctx-combo-option.active{background:var(--primary-soft)}
.ctx-combo-name{font-size:12px;color:var(--ink-900);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ctx-combo-code{font-size:10px;color:var(--ink-500)}
.ctx-combo-empty{padding:16px 10px;text-align:center;font-size:12px;color:var(--ink-500)}
.ctx-divider{width:1px;height:20px;background:var(--line);margin:0 4px}
.topbar-actions{margin-left:auto;display:flex;align-items:center;gap:8px}
.user-chip{display:flex;align-items:center;gap:9px;padding:4px 6px 4px 4px;border-radius:8px;cursor:pointer}
.user-chip:hover{background:var(--surface-3)}
.avatar{width:32px;height:32px;border-radius:8px;background:linear-gradient(135deg,#2b6cb0,#1a4a8a);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:600;font-size:13px}
.user-meta{display:flex;flex-direction:column;line-height:1.3}
.user-meta strong{font-size:12px;color:var(--ink-900)}
.user-meta span{font-size:10px;color:var(--ink-500)}
.user-chip .chev{width:13px;height:13px;fill:none;stroke:var(--ink-400);stroke-width:2}

/* 内容区 */
.content{flex:1;padding:0 24px 32px;min-height:0}
.breadcrumb{display:flex;align-items:center;gap:6px;padding:16px 0 14px;font-size:12px;color:var(--ink-500)}
.breadcrumb svg{width:13px;height:13px;fill:none;stroke:var(--ink-400);stroke-width:1.8}
.breadcrumb .sep{color:var(--ink-400)}
.breadcrumb strong{color:var(--ink-800);font-weight:500}

/* 响应式 */
@media(max-width:960px){
  .sidebar{width:var(--sidebar-w-collapsed);flex-basis:var(--sidebar-w-collapsed)}
  .brand-text,.nav-section-title,.nav-label,.nav-chevron,.sidebar-tip,.sidebar-version{display:none}
  .nav-item{justify-content:center;padding:10px 0}
  .app-main{margin-left:var(--sidebar-w-collapsed)}
  .user-meta{display:none}
  .content{padding:0 14px 24px}
  .topbar{padding:0 14px}
}
@media(max-width:640px){
  .ctx-label,.ctx-divider{display:none}
  .ctx-select{max-width:130px}
  .ctx-combo-trigger{width:130px;max-width:130px}
  .ctx-combo-menu{width:260px}
}
